Skip to main content

More Info:

Kubernetes provides a default namespace, where objects are placed if no namespace is specified for them. Placing objects in this namespace makes application of RBAC and other controls more difficult.

Risk Level

Low

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CIS EKS
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Manual Steps

  1. List all user resources in the default namespace
    Run on: any machine with kubectl access
  2. Decide target namespaces and create them if needed
    For each logical application/group of resources, pick or create a dedicated namespace.
    Example (adjust names as needed):
    If a namespace already exists, you do not need to recreate it:
  3. Export manifests of resources currently in the default namespace
    Run once per resource type you want to move; redirect to files for review/edit.
    Examples (adjust types as needed based on step 1 output):
    Review these files in an editor and for each object:
    • Change metadata.namespace: default to the desired namespace.
    • Adjust names/labels/annotations if you need to separate apps into different namespaces.
    • For ServiceAccountName, ConfigMap, Secret, RoleBinding, etc., ensure referenced objects will also exist in the new namespace.
  4. Recreate resources in their new namespaces
    After editing the exported files, apply them:
    Confirm they exist in the new namespaces:
  5. Delete migrated resources from the default namespace
    Only after confirming that workloads are running correctly in their new namespaces, delete the originals.
    Example (adjust types/names as needed; you can use --all where appropriate):
    Be careful not to delete any system-created objects; inspect with:
  6. Verification (no user resources left in default namespace)
    Run on: any machine with kubectl access
On any machine with kubectl access:
  1. Identify all user resources in the default namespace
  1. For each application, create a dedicated namespace (example: my-app)
  1. Export and re-apply namespaced resources into the new namespace
    (adapt my-app and resource selectors as needed)
  1. Delete the old copies from the default namespace
    (ensure the app is healthy in the new namespace first)
Repeat steps 2–4 for each application currently using the default namespace, choosing an appropriate namespace name and label selector.
  1. (Optional) Add a warning label/annotation to discourage use of default namespace
  1. Verification