Skip to content

Namespace

In one line

A Namespace is a Kubernetes feature that groups resources into a named, isolated virtual cluster within a physical cluster.

In simple words

A Namespace is a way to divide a single Kubernetes cluster into multiple virtual clusters. Resources in different namespaces are isolated from each other — you can have a Pod named "my-app" in both the "dev" and "prod" namespaces without conflict.

Namespaces are useful for: environment separation (dev, staging, prod in one cluster), team isolation (team-a, team-b), and resource quotas (limiting how much CPU/memory each namespace can use).

By default, Kubernetes has three namespaces: default (where resources go if no namespace is specified), kube-system (Kubernetes internal components), and kube-public (publicly readable resources).

Example

bash
# Create a new namespace
kubectl create namespace my-team

# Deploy to a specific namespace
kubectl apply -f deployment.yaml -n my-team

# List pods in a namespace
kubectl get pods -n my-team

These commands create a namespace, deploy resources to it, and list pods within it.

How it works

  1. You create a Namespace with kubectl create namespace.
  2. You specify the namespace in your resource metadata or via the -n flag.
  3. Resources in different namespaces are isolated and can have the same names.
  4. You can set ResourceQuotas to limit usage per namespace.

Common confusions

  • Confused with: Node

    The difference: A Namespace is a logical division of resources within the cluster; a Node is a physical or virtual machine in the cluster.

Related terms

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary