Kubernetes Namespaces allow multiple teams to share a single cluster without stepping on each other's toes. They create logical partitions that provide resource isolation, access control, and cost visibility.
What Is a Namespace?
A namespace is a virtual cluster inside your physical cluster. It acts as a logical partition, enabling you to run team-a/database and team-b/database side by side without naming conflicts.
Key Features
- Name Scoping: Identical resource names can exist in different namespaces without collision.
- ResourceQuota: Set caps on CPU, memory, and object counts to prevent any single team from starving the cluster.
- Namespace-Scoped RBAC: Grant teams permission to see and modify only their own namespace.
- Cost Visibility: Track spending per namespace to understand which team is consuming what resources.
Important Caveat
A namespace is not a security wall. By default, pods can communicate across namespaces. For real isolation, you must combine namespaces with NetworkPolicies, ResourceQuotas, and RBAC. Nodes and storage remain cluster-wide and are not namespaced.
Hands-On Commands
# Create a namespace
kubectl create namespace team-bravo
# List pods in a specific namespace
kubectl get pods -n team-charlie
Use namespaces to organize your cluster, but remember: true multi-tenancy requires layered security controls beyond simple logical boundaries.