More Info:
Namespaces provide administrative and security boundaries between groups of resources. Create namespaces for the objects in your deployment as needed.Risk Level
MediumAddress
SecurityCompliance Standards
- CIS AKS
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Inventory current namespaces and workloads
- Run on: any machine with kubectl access
- Commands:
- Review which user workloads (apps) are running in
default,kube-system, or other shared namespaces instead of dedicated ones.
-
Map workloads to organizational or security boundaries
- Decide how to group workloads into namespaces, for example by:
- Environment:
dev,test,staging,prod - Team/owner:
payments,analytics,platform - Sensitivity:
public,internal,restricted
- Environment:
- Document for each application which namespace it should belong to and which other workloads it should be administratively separated from.
- Decide how to group workloads into namespaces, for example by:
-
Design the namespace layout and policies
- For each planned namespace, decide:
- Purpose and owner
- Required access controls (RBAC) and network separation (if using NetworkPolicies)
- Any resource quotas/limits that should apply
- Optionally draft a namespace manifest template, for example:
- For each planned namespace, decide:
-
Create the required namespaces
- Run on: any machine with kubectl access
- For a simple namespace:
- Or apply a manifest (repeat per namespace):
-
Refactor workloads to use the new namespaces
- Update manifests/Helm charts/IaC so each workload specifies the intended namespace and is no longer deployed into
defaultor other shared namespaces. Examples:- With kubectl:
- In a manifest, omit
namespaceundermetadataand deploy with-n, or set an explicitmetadata.namespacealigned to your design.
- With kubectl:
- Carefully migrate existing workloads:
- Export current manifest, adjust namespace, re-apply, then delete the old object:
- Export current manifest, adjust namespace, re-apply, then delete the old object:
- Ensure dependent objects (Services, ConfigMaps, Secrets, RBAC bindings) are created in the same namespace and references are updated.
- Update manifests/Helm charts/IaC so each workload specifies the intended namespace and is no longer deployed into
-
Verify namespace-based separation is in place
- Run on: any machine with kubectl access
- Commands:
- Confirm that:
- User workloads are not running in
defaultorkube-system. - Workloads are grouped into the intended namespaces that reflect your administrative and security boundaries.
- User workloads are not running in
Using kubectl
Using kubectl
Using kubectl
1. List all namespaces and basic metadata
Run on: any machine with kubectl access- Problem indicators:
- Only
default,kube-system,kube-public,kube-node-lease, and a small number of broad “catch‑all” namespaces likedevorprod, but many unrelated apps in each. - Business‑critical and non‑critical workloads mixed in the same namespace.
- Security‑sensitive workloads (e.g., with elevated permissions) sharing a namespace with general apps.
- Only
2. See what runs in each namespace
Run on: any machine with kubectl accessAll workloads per namespace:default):- Problem indicators:
- Many unrelated applications coexisting in a single namespace (e.g., multiple teams’ apps, shared test and production workloads).
- System components or operators deployed in
defaultinstead of their own namespaces. - Lack of clear grouping (names don’t suggest ownership, environment, or function).
3. Identify applications still using the default namespace
Run on: any machine with kubectl access- Problem indicators:
- Long list of application resources in
default(not just small test/demo items). - Multi-team or multi-tenant workloads all deployed to
default.
- Long list of application resources in
4. Inspect labels to infer ownership and boundaries
Run on: any machine with kubectl access- Problem indicators:
- Pods from different teams or applications (as indicated by labels like
app,team,owner) mixed in the same namespace when they should be administratively separated. - Lack of consistent labeling, making it hard to reason about who owns what in each namespace.
- Pods from different teams or applications (as indicated by labels like
5. Review namespace-level policies and their scope
Run on: any machine with kubectl accessNetworkPolicies:- Problem indicators:
- Few namespaces with NetworkPolicies, ResourceQuotas, or RBAC bindings, implying broad, shared namespaces with weak administrative separation.
- Single namespace where many different RoleBindings/roles are used to approximate per-team isolation instead of using separate namespaces.
6. Inspect specific namespaces in detail
Run on: any machine with kubectl access- Problem indicators:
- Namespace description and contents show mixed environments (e.g., both
devandprodworkloads). - Shared namespace used by multiple teams or tenants with no corresponding isolation mechanisms, suggesting missing administrative boundaries.
- Namespace description and contents show mixed environments (e.g., both
Automation
Automation
-
Workloads in shared / system namespaces
- Output section 8: non‑platform application pods running in
default,kube-system, orkube-publicindicate missing administrative boundaries. - Expected: only core components and intentionally shared infra in these namespaces.
- Output section 8: non‑platform application pods running in
-
Single namespace hosting unrelated applications
- Output sections 1 and 3: many distinct applications or teams sharing the same namespace (especially
default) suggests boundaries are not defined by function, environment, or owner.
- Output sections 1 and 3: many distinct applications or teams sharing the same namespace (especially
-
Lack of NetworkPolicies
- Output section 7: namespaces listed as “without any NetworkPolicy” are likely on a flat network with no namespace‑level traffic controls, weakening isolation.
-
ClusterRoles used inside many namespaces
- Output sections 4 and 5: the same
ClusterRolereferenced in manyRoleBindingsacross several namespaces can indicate that a nominal namespace boundary is bypassed by broad RBAC.
- Output sections 4 and 5: the same
-
System and user workloads mixed on the same nodes without taints/labels
- Output section 9: no meaningful taints/labels separating system and user workloads can make it harder to enforce different policies per boundary.
-
Catch‑all / ambiguous namespaces
- Output sections 1–3: namespaces with vague names (e.g.,
misc,shared,tools) containing many different workloads usually indicate missing per‑team or per‑app namespaces.
- Output sections 1–3: namespaces with vague names (e.g.,

