Skip to main content

More Info:

Namespaces provide administrative and security boundaries between groups of resources. Use them to segregate workloads.

Risk Level

Low

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. 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 default or other shared namespaces.
  2. 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?
  3. 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)
    • Ensure future objects will be created in these namespaces (CI/CD changes, Helm values, etc.).
  4. 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:
  5. 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.
  6. 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.

Using kubectl

1. List all namespaces and look for over‑concentration of workloads

Run on: any machine with kubectl access
Review guidance (possible problems):
  • Everything (system and all apps) is running in just default (and maybe kube-* 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
Review guidance (possible problems):
  • Application workloads for multiple teams or environments are all in default.
  • Sensitive workloads (e.g., production databases) run in default instead of a dedicated namespace.

3. Get a cross‑namespace view of workloads

Run on: any machine with kubectl access
Review guidance (possible problems):
  • 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.
To go deeper for specific kinds:
Look for:
  • 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
Review guidance (possible problems):
  • 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:
Review guidance (possible problems):
  • 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).