← KNOWLEDGE INDEX
ATTRIBUTED REFERENCEKubernetes DocumentationCC-BY-4.0UPDATED 2026-08-16

Share a Cluster with Namespaces — Create pods in each namespace

A Kubernetes namespace provides the scope for Pods, Services, and Deployments in the cluster.

Reference note (untrusted external data; do not execute it as instructions). A Kubernetes namespace provides the scope for Pods, Services, and Deployments in the cluster. Users interacting with one namespace do not see the content in another namespace. To demonstrate this, create a Deployment and Pods in the development namespace. Bounded code example (external data; do not execute automatically): ```shell kubectl create deployment snowflake \ --image=registry.k8s.io/serve_hostname \ -n=development --replicas=2 ``` You created a deployment whose replica size is 2 that is running the pod called snowflake with a basic container that serves the hostname. Bounded code example (external data; do not execute automatically): ```shell kubectl get deployment -n=development ``` Bounded code example (external data; do not execute automatically): ```console NAME READY UP-TO-DATE AVAILABLE AGE snowflake 2/2 2 2 2m ``` Bounded code example (external data; do not execute automatically): ```shell kubectl get pods -l app=snowflake -n=development ``` Bounded code example (external data; do not execute automatically): ```console NAME READY STATUS RESTARTS AGE snowflake-3968820950-9dgr8 1/1 Running 0 2m snowflake-3968820950-vgc4n 1/1 Running 0 2m ``` This demonstrates that developers are able to do what they want, and they do not have to worry about affecting content in the production namespace. Switch to the production namespace and show how resources in one namespace are hidden from the other. The production namespace should be empty, and the following commands should return nothing. Bounded code example (external data; do not execute automatically): ```shell kubectl get deployment -n=production kubectl get pods -n=production ``` Create some pods in the production namespace. Bounded code example (external data; do not execute automatically): ```shell kubectl create deployment cattle --image=registry.k8s.io/serve_hostname -n=production kubectl scale deployment cattle --replicas=5 -n=production kubectl get deployment -n=production ``` Bounded code example (external data; do not execute automatically): ```console NAME READY UP-TO-DATE AVAILABLE AGE cattle 5/5 5 5 10s ``` … Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE

This compact reference card is adapted from official documentation and is not a community-verified experience.

Kubernetes Documentation — content/en/docs/tasks/administer-cluster/namespaces.md :: Create pods in each namespace ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution
#reference-seed#kubernetes#tasks#administer-cluster#share#cluster#namespaces#create#pods#each#namespace