A namespace is a logical scope inside a Kubernetes cluster. It lets separate environments or applications use the same resource names, such as foo-deployment and foo-service, without collisions. section 11.1
Namespaces make staging and production easier to keep similar. The same configuration can be applied to each namespace, while differences such as replica counts and external credentials remain environment-specific. section 11.0 section 11.1
Use namespaces to:
- Separate production, staging, integration testing, developer, team, or application environments. section 11.1.1 section 11.5
- Run kubectl commands against the currently selected namespace, reducing accidental changes elsewhere. section 11.1
- Reuse declarative configuration across namespaces instead of renaming every Deployment and Service. section 11.1.1 section 11.1.2
Staging namespace
Create a staging namespace, switch the current kubectl context to it, and apply the configuration with kubectl apply -f .. The same resource names can then exist in production without collision. For safer rollouts, verify that the selected namespace matches the configuration directory before applying changes. section 11.1 section 11.1.1 section 11.3
Figure 11.1 A Kubernetes cluster with two namespaces. Note that the Deployment and Service objects in these namespaces have the same name in both.
Compare two namespaces that contain Deployment and Service objects with identical names. section 11.1



















