More Info:
Namespaces provide administrative and security boundaries between groups of resources. Use them to segregate workloads.Risk Level
LowAddress
SecurityCompliance Standards
- CIS Kubernetes
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Inventory current namespaces and workloads
- Run on: any machine with kubectl access
- Command:
- Purpose: Identify what namespaces exist and which Pods/Services/Deployments are concentrated in
defaultor other shared namespaces.
-
Identify security/administrative domains that should be isolated
- Run on: any machine with kubectl access
- Commands (to help group by label/owner):
- Review points:
- Which teams, environments (dev/test/stage/prod), or applications share a namespace?
- Which workloads have different data sensitivity, access requirements, or change-control rules but share a namespace?
-
Decide and document a namespace model
- No command; design decision.
- Suggested patterns to evaluate:
- Per-environment (e.g.,
dev,staging,prod) - Per-team (e.g.,
team-a,team-b) - Per-application or domain (e.g.,
payments,analytics)
- Per-environment (e.g.,
- Ensure future objects will be created in these namespaces (CI/CD changes, Helm values, etc.).
-
Create required namespaces
- Run on: any machine with kubectl access
- Commands (example – adjust names to your model):
- For GitOps/manifest-driven clusters, create YAML instead and apply via your pipeline:
Apply:
-
Plan and migrate workloads out of shared/default namespaces
- Run on: any machine with kubectl access
- Evidence to gather for each namespace you intend to clean up:
- For each application, update its manifests/Helm values/CI to set
metadata.namespace: <target-namespace>, then re-deploy there. Clean up old objects after validating functionality.
-
Verify namespace-based segregation is in place
- Run on: any machine with kubectl access
- Commands:
- Review points:
- Sensitive or production workloads run in dedicated namespaces, not
default. - Distinct teams/environments/applications have their own namespaces according to your model.
- New deployments (from CI/CD) are landing in the intended namespaces, not in
default.
- Sensitive or production workloads run in dedicated namespaces, not
Using kubectl
Using kubectl
Using kubectl
1. List all namespaces and look for over‑concentration of workloads
Run on: any machine with kubectl access- Everything (system and all apps) is running in just
default(and maybekube-*system namespaces). - Business‑critical, dev, and test workloads are all in the same non‑system namespace.
2. See what’s running in the default namespace
Run on: any machine with kubectl access- Application workloads for multiple teams or environments are all in
default. - Sensitive workloads (e.g., production databases) run in
defaultinstead of a dedicated namespace.
3. Get a cross‑namespace view of workloads
Run on: any machine with kubectl access- A small number of namespaces containing a large mix of unrelated workloads.
- No clear separation by environment (e.g., prod/stage/dev) or by tenant/team when that is a requirement.
- Deployments/StatefulSets/DaemonSets from multiple teams or tenants sharing one namespace without justification.
4. Inspect labeling/ownership patterns
Run on: any machine with kubectl access- No labels to indicate environment (
env=prod|stage|dev) or owner/team when such separation is expected. - Namespaces used as a “dumping ground” with unclear purpose.
5. Spot potential multi‑tenant or shared admin issues
Run on: any machine with kubectl accessCheck for role bindings that span many subjects in a shared namespace:- A single shared namespace where many different user groups are granted broad access, instead of each having their own namespace.
- Cluster‑wide roles used where namespace‑scoped roles and separate namespaces would provide better isolation.
If these reviews show that unrelated workloads, tenants, or environments are co‑located in the same namespace without a clear reason, that indicates missing or insufficient administrative boundaries and may require a namespace design change (performed via manifests/kubectl and aligned with your org’s requirements).
Automation
Automation

