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
LowAddress
SecurityCompliance 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
Remediation
Manual Steps
Manual Steps
-
List all user resources in the default namespace
Run on: any machine with kubectl access -
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: -
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: defaultto 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.
- Change
-
Recreate resources in their new namespaces
After editing the exported files, apply them:Confirm they exist in the new namespaces: -
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--allwhere appropriate):Be careful not to delete any system-created objects; inspect with: -
Verification (no user resources left in default namespace)
Run on: any machine with kubectl access
Using kubectl
Using kubectl
On any machine with kubectl access:Repeat steps 2–4 for each application currently using the
- Identify all user resources in the default namespace
- For each application, create a dedicated namespace (example:
my-app)
- Export and re-apply namespaced resources into the new namespace
(adaptmy-appand resource selectors as needed)
- Delete the old copies from the default namespace
(ensure the app is healthy in the new namespace first)
default namespace, choosing an appropriate namespace name and label selector.- (Optional) Add a warning label/annotation to discourage use of default namespace
- Verification
Automation
Automation

