Review workload namespace organization

Organize application namespaces by operational purpose and apply actual access and network policies.

Description

default is valid for ordinary workloads. Give applications their own namespaces when ownership or access requirements differ. Reserve kube-system and kube-public for their system roles.

Potential impact

When applications share a namespace, it can be hard to identify the owner of a resource or limit an operator’s access to one application.

Remediation

Assign an owner to each namespace. Set RBAC, NetworkPolicies and resource quotas, then test application accounts’ permissions and connectivity between Pods.

Examples

Create cosmic-pod before deploying frontend and replace the sample image with your application image.

Before

yaml
apiVersion: v1
kind: Pod
metadata:
  name: frontend
  namespace: default
spec:
  containers:
    - name: app
      image: images.my-company.example/app:v4

After

yaml
apiVersion: v1
kind: Pod
metadata:
  name: frontend
  namespace: cosmic-pod
spec:
  containers:
    - name: app
      image: images.my-company.example/app:v4

References