Namespaced vs Cluster-Scoped Resources
What you'll learn: You'll understand how Kubernetes organizes resources into namespace-level and cluster-level scopes, and why this distinction matters for multi-tenant environments.
The Core Concept
In Kubernetes, resources fall into two scopes: namespaced and cluster-scoped. Namespaced resources exist within a specific namespace (like an apartment within a building), while cluster-scoped resources are global across the entire cluster (like the building's foundation or utility systems).
Namespaced Resources
These resources are isolated within a namespace boundary. Multiple teams or applications can have resources with the same name in different namespaces without conflict.
Common namespaced resources:
- Pods
- Services
- Deployments
- ConfigMaps
- Secrets
Think of namespaces as separate rooms in a house—each room can have its own "lamp" without confusion.
Cluster-Scoped Resources
These resources exist at the cluster level and are shared across all namespaces. They typically define cluster-wide policies, infrastructure, or access controls.
Common cluster-scoped resources:
- Nodes (the physical/virtual machines)
- Namespaces themselves
- PersistentVolumes
- ClusterRoles
- StorageClasses
These are like the house's electrical wiring or plumbing—infrastructure that serves all rooms equally.
Why This Matters
This separation enables multi-tenancy: different teams can work in isolated namespaces without stepping on each other's toes, while cluster administrators manage shared infrastructure through cluster-scoped resources. When you query the API Server, you specify a namespace for namespaced resources or omit it for cluster-scoped ones.
Key Takeaway: Namespaced resources provide isolation within logical boundaries, while cluster-scoped resources define global cluster infrastructure—understanding this distinction is essential for proper resource organization and access control.