More Info:
Placing resources in the default namespace prevents proper segregation and access control. Use purpose-specific namespaces instead.Risk Level
LowAddress
SecurityCompliance Standards
- CIS Kubernetes
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
List all workloads and core resources in the
defaultnamespace- Run on: any machine with
kubectlaccess
Review whether each object is intentionally indefaultor just there by habit/convenience. - Run on: any machine with
-
Identify ownership and required segregation for each object
- Run on: any machine with
kubectlaccess
For each application or component, decide:- Which team/tenant owns it.
- What security or lifecycle boundaries it needs.
- What namespace(s) should exist instead (e.g.,
team-a-prod,shared-infra,monitoring).
- Run on: any machine with
-
Create or confirm purpose-specific namespaces
- Run on: any machine with
kubectlaccess
For each logical grouping you identified:
(Adjust names as decided; skip if already present:kubectl get nsto check.)
Optionally add labels/annotations to express purpose/ownership: - Run on: any machine with
-
Plan and migrate resources out of
defaultto their target namespaces- Run on: any machine with
kubectlaccess
For each object to move:
- Export its manifest:
- Edit the file:
- Change
metadata.namespace: defaultto the target namespace. - Update references (serviceAccountName, ConfigMap/Secret names, RoleBindings, NetworkPolicies) if they change.
- Change
- Apply to the new namespace and delete from
default:
- Run on: any machine with
-
Harden RBAC and defaults to discourage future use of
default- Run on: any machine with
kubectlaccess
Consider: - Removing broad bindings in
default: - Creating least-privilege RoleBindings only in intended namespaces and ensuring users’ kubeconfigs specify a non-default namespace:
- Run on: any machine with
-
Verify that
defaultis no longer used for application resources- Run on: any machine with
kubectlaccess
Confirm that:- Only objects you explicitly want there remain (often just system bootstrap artifacts, if any).
- All application, team, or environment-specific resources have been moved to purpose-specific namespaces.
- Run on: any machine with
Using kubectl
Using kubectl
Using kubectl
Run these commands from any machine withkubectl access.1. List all namespaces and spot obvious mis-use of default
- Only
default,kube-system, and other system namespaces exist, and no clearly purpose-specific namespaces for apps or teams. - Application names suggest they should have their own namespaces, but do not (e.g., you see
payments,frontendas Deployments indefaultlater).
2. See what is currently running in the default namespace
- Business applications (e.g.,
orders-api,payments-db,frontend) running indefault. - Shared infrastructure components (e.g., logging, monitoring, CI/CD agents) running in
default. - Any long-lived workloads or services that clearly belong to a specific team, environment (dev/test/prod), or function, but are not in a dedicated namespace.
default for:- Only temporary/manual testing objects, clearly named as such and cleaned up regularly, is usually acceptable.
- Anything production-like is a concern.
3. Check RBAC bindings that reference the default namespace
- Broad roles (e.g., with
*verbs or many resources) attached indefault, especially if:defaultcontains many or critical workloads.- ServiceAccounts in
defaultare used by multiple apps/teams.
4. Check what is using the default ServiceAccount
- Many or critical pods using the implicit
defaultServiceAccount (<none>ordefaultin the output), especially if:- Those pods belong to distinct applications that should have isolated privileges.
- There are no app-specific ServiceAccounts/roles/namespaces.
5. Review cluster-wide workloads that omit a namespace (using default implicitly)
To spot resources that may be created without specifying -n or metadata.namespace:- Any production or shared system component appearing in
default. - Patterns showing that most application resources land in
defaultinstead of in dedicated namespaces.
Use these observations to decide:
- Which applications or components currently in
defaultshould be moved into dedicated namespaces. - What namespace structure (per app, per team, per environment) best supports your access control and segregation requirements.
Automation
Automation

