More Info:
Using the default namespace for user resources hampers resource segregation and fine-grained RBAC. Move user-defined objects into dedicated namespaces.Risk Level
LowAddress
SecurityCompliance Standards
- CIS EKS
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Identify user resources in the default namespace
- Run on: any machine with kubectl access
-
Create one or more dedicated namespaces to move resources into
- Run on: any machine with kubectl access
-
Move workload resources (Deployments, StatefulSets, Services, etc.) out of default
- Run on: any machine with kubectl access
Export each object fromdefault, remove cluster-assigned fields, and re-create it in the new namespace. Example for a Deployment:
Repeat this pattern for other namespaced resource kinds (e.g.,statefulset,daemonset,service,ingress,cronjob,job,configmap,secret,pvc), adjusting the kind and name in the commands. - Run on: any machine with kubectl access
-
Update references that point to the default namespace
- Run on: any machine with kubectl access
Search manifests or Helm values you use to deploy resources and update any explicitnamespace: defaultfields, or-n defaultCLI flags, to the new namespace:
Redeploy with the corrected manifests/Helm charts so future resources are created in the dedicated namespaces. - Run on: any machine with kubectl access
-
Review and adjust RBAC for new namespaces
- Run on: any machine with kubectl access
Bind roles to users/service accounts in the new namespaces instead ofdefault. Example:
- Run on: any machine with kubectl access
-
Verify no user resources remain in the default namespace
- Run on: any machine with kubectl access
Using kubectl
Using kubectl
On any machine with kubectl access:Example for Services (be careful with in-cluster DNS names and consumers):Example for ConfigMaps:Example for Secrets (excluding default service account tokens; filter by name as needed):Repeat the same pattern for other resource kinds present in
- Identify user resources in the
defaultnamespace
- For each resource type, decide a target namespace and create it if needed (example:
team-a)
- Move namespaced resources out of
defaultusingkubectl get -o yaml | sed | kubectl apply
default (e.g., statefulset, job, cronjob, ingress, role, rolebinding, networkpolicy, etc.):- Verification (same logic as the audit):
Automation
Automation

