Skip to main content

More Info:

Use namespaces to isolate your Kubernetes objects.

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
    Review whether application, platform, and system components are clearly separated (for example: kube-system, monitoring, logging, team-a, team-b, etc.).
  2. Map workloads to teams/environments and desired boundaries
    Run on: any machine with kubectl access
    For each workload, decide which administrative boundary it should belong to (per team, per environment like dev/stage/prod, per application, or per data classification). Document the target namespace layout (e.g., team-a-dev, team-a-prod, shared-infra).
  3. Identify objects in inappropriate or overly shared namespaces
    Run on: any machine with kubectl access
    Flag any non-system workloads running in default or in a namespace that does not match the intended boundary from step 2.
  4. Define or create the required namespaces
    Run on: any machine with kubectl access
    For each desired namespace that does not yet exist:
    Optionally prepare namespace manifests for GitOps/IaC:
    Apply with:
  5. Plan and execute workload relocation into proper namespaces
    Run on: any machine with kubectl access
    For each object identified in step 3, update its manifest to set metadata.namespace: <target-namespace> and re-apply:
    Repeat similarly for services, configmaps, secrets, ingresses, and other namespaced resources, ensuring references (service names, configMapRefs, secretRefs, PVCs) remain valid in the new namespace.
  6. Verify namespace-based boundaries are in place
    Run on: any machine with kubectl access
    Confirm that:
    • default contains no long-lived application workloads unless explicitly intended.
    • Workloads are grouped into namespaces that reflect the documented administrative boundaries (teams, environments, or applications) and that cross-team/environment sharing is limited to explicitly designated shared namespaces.

Using kubectl

1. List all namespaces and their basic metadata

Run on: any machine with kubectl access
Review for:
  • Only default plus system namespaces (kube-system, kube-public, kube-node-lease, any cloud-provider system namespaces) in a busy cluster.
  • Many unrelated apps or teams apparently all using default.
Both suggest missing administrative boundaries.

2. See what is running in each namespace

Run on: any machine with kubectl access
Look for:
  • Multiple unrelated applications (different teams, environments, or tenants) mixed in the same non-system namespace.
  • Business-critical workloads running in default.
This can indicate insufficient isolation between applications or tenants.

3. Inventory higher-level objects by namespace

Run on: any machine with kubectl accessWorkloads:
Services, ingresses, and configs:
Indicators of a problem:
  • Namespaces that act as “junk drawers” for many unrelated workloads/configs.
  • Shared namespace holding both production and non-production resources.
  • Shared namespace used by multiple teams/tenants (you’ll identify this by naming conventions or labels from your environment).

4. Check for labeling that reflects ownership or environment

Run on: any machine with kubectl access
You may also want:
Potential issues:
  • No labels reflecting owner/team, environment (prod, dev, test), or tenant where that separation is expected in your organization.
  • Single namespace apparently serving multiple environments or tenants based on object names inside it (e.g., prod-* and dev-* resources mixed together).

5. Review access control by namespace (for context)

While this check is about namespaces themselves, RBAC use can show whether namespaces are being used as an administrative boundary.Run on: any machine with kubectl access
What may indicate a problem:
  • Heavy use of ClusterRoleBinding to grant broad access, instead of RoleBinding scoped to specific namespaces, suggesting that namespaces are not being used as boundaries.
  • Same service account or user bound to roles across many unrelated namespaces without a clear reason.

6. Focus review on the default namespace

Run on: any machine with kubectl access
Red flags:
  • Application workloads from multiple teams or environments all live in default.
  • Critical workloads live in default instead of a clearly named, dedicated namespace.

kubectl cannot decide the correct namespace design for you. Use the above outputs to determine whether your current namespace layout reflects your organizational boundaries (teams, tenants, environments, or applications) and adjust your manifests and deployment processes accordingly.
How to run
  • Run on any machine with kubectl and jq installed and access to the cluster:
What output indicates a problem
  • Namespaces where:
    • Many unrelated apps and teams share the same namespace.
    • Application pods are present in kube-system or other system namespaces.
    • Critical shared services live only in default.
    • Only the default ServiceAccount is used for many workloads.
    • There are many workloads but zero NetworkPolicies.
    • ClusterRoleBindings grant broad privileges to subjects from many namespaces.
These patterns suggest weak administrative boundaries; decisions on new namespace layout and workload moves must be made manually.

Additional Reading: