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:

  1. 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.

  2. 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.

  3. 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.

  4. Confirm the test object is listed from the namespace.
    $ kubectl get configmap namespace-smoke --namespace team-a
    NAME              DATA   AGE
    namespace-smoke   1      0s
  5. 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.