Skip to main content

More Info:

Verifies the default namespace has no workloads so RBAC, quotas and NetworkPolicies can be scoped per tenant.

Risk Level

Medium

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. List all workloads in the default namespace (run on any machine with kubectl access):
  2. For each workload type in default, export its manifest to a file (replace placeholders with actual names from step 1; run on any machine with kubectl access): Deployments:
    StatefulSets:
    DaemonSets:
    Jobs/CronJobs:
  3. Edit each exported manifest to target a purpose-specific namespace (run on any machine with kubectl access):
    If the metadata.namespace field is missing, add it under metadata::
    Repeat for each manifest. Ensure the <target-namespace> already exists, or create it:
  4. Apply the modified manifests into the new namespace (run on any machine with kubectl access):
  5. After confirming the workloads are running correctly in the new namespace, delete the originals from default (run on any machine with kubectl access):
  6. Verification (derived from the audit command; run on any machine with kubectl access):
    Confirm that podCount=0 and is_compliant=true.
On any machine with kubectl access:
  1. Identify all workload types in the default namespace
  1. Choose or create a purpose-specific namespace (example: team-a)
  1. Export existing workloads from default and edit their namespace
Edit /tmp/default-workloads.yaml:
  • For every object, set:
  • Remove runtime-only fields under metadata such as:
    • creationTimestamp
    • resourceVersion
    • uid
    • annotations that are managed by controllers (e.g. deployment.kubernetes.io/revision)
    • generation
  • Remove status sections:
  1. Apply workloads into the new namespace
  1. Delete old workloads from the default namespace
Be careful to delete only what you intentionally moved; do not delete the kubernetes Service.
  1. Verify no pods remain in the default namespace (benchmark audit)