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 Deployment/StatefulSet/DaemonSet/Job/CronJob in default, export its manifest to a file and edit the namespace (run on any machine with kubectl access). Example for a Deployment named my-app:
    Edit my-app.yaml and change:
    to:
    Ensure my-tenant-namespace exists:
  3. Apply the updated workload manifest in the new namespace (run on any machine with kubectl access):
  4. Once you confirm the workload is Running in the new namespace, delete the old object from default (run on any machine with kubectl access). Example:
  5. Repeat steps 2–4 for all remaining controllers and standalone Pods in default. For a standalone Pod called my-pod:
  6. Verification (run on any machine with kubectl access):
    Confirm podCount=0 and is_compliant=true.
On any machine with kubectl access:
  1. Identify workloads currently in the default namespace
  1. For each workload type, export its manifest from default and prepare it for a new namespace. Replace my-namespace with your target namespace name (which should already exist or be created ahead of time):
Deployments:
StatefulSets:
DaemonSets:
Jobs:
CronJobs:
ReplicaSets (if you have standalone ones you want to keep):
Services, ConfigMaps, Secrets, and ServiceAccounts that belong with those workloads should also be moved:Services:
ConfigMaps:
Secrets (exclude built‑ins you don’t want to move, adjust selector as needed):
ServiceAccounts (excluding the default one):
  1. Apply the generated manifests into the new namespace
(From a directory containing only the YAMLs you intend to move.)
  1. After confirming the workloads are running correctly in my-namespace, delete them from default.
Deployments, StatefulSets, DaemonSets, Jobs, CronJobs:
If you need more control, delete selected objects by name instead of --all.
  1. Verification (from any machine with kubectl access)