A Kubernetes namespace gives a team, application, or environment its own naming scope inside one cluster. It is useful when workloads need separate object names, policies, quotas, and access boundaries without creating another cluster.
kubectl create namespace sends a Namespace object to the API server and returns after the object is accepted. The namespace name must be unique across the cluster, and namespaced objects can then be created with --namespace or a context that already selects that namespace.
A namespace does not isolate compute by itself. Pair it with RBAC, ResourceQuota, LimitRange, labels, and network policy when the new area needs real tenant, team, or environment controls.
Steps to create a Kubernetes namespace:
- Create the namespace.
$ kubectl create namespace team-a namespace/team-a created
Use a DNS-label style name such as team-a or staging. Namespace names are cluster-wide, so choose a name that will not conflict with another team or environment.
- Check that the namespace is active.
$ kubectl get namespace team-a NAME STATUS AGE team-a Active 0s
The Active phase means the API server accepted the namespace and it is available for namespaced resources.
- Create a small test ConfigMap in the namespace.
$ kubectl create configmap namespace-smoke --from-literal=owner=team-a --namespace team-a configmap/namespace-smoke created
The --namespace flag keeps the test object in the new namespace without changing the current kubectl context.
- Confirm the test object is listed from the namespace.
$ kubectl get configmap namespace-smoke --namespace team-a NAME DATA AGE namespace-smoke 1 0s
- Remove the test ConfigMap.
$ kubectl delete configmap namespace-smoke --namespace team-a configmap "namespace-smoke" deleted from team-a namespace
The namespace remains in place for application objects, RBAC bindings, quotas, and policies after the smoke-test object is removed.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.