Namespaces

Harry · 11 Sep 2026 · 9 views

Organising the Cluster

A namespace partitions a cluster into logical groups. Teams, environments (dev, staging, prod) and application stacks each get their own namespace so resources stay tidy.

Working With Namespaces

kubectl create namespace payments
kubectl get namespaces
kubectl get pods -n payments
kubectl config set-context --current --namespace=payments

Set a namespace in a manifest with metadata.namespace, or scope all commands with -n.

Default Namespaces

  • default - where resources go unless you say otherwise.
  • kube-system - control-plane components (API server, etcd, CoreDNS).
  • kube-public - cluster-wide public resources.
  • kube-node-lease - agent heartbeats used by the scheduler.

Resource Quotas

Namespaces also enforce limits with ResourceQuota and LimitRange:

apiVersion: v1
kind: ResourceQuota
metadata:
  name: compute-quota
  namespace: payments
spec:
  hard:
    pods: "10"
    requests.cpu: "4"
    limits.memory: 8Gi

Key Points

  • Namespaces isolate teams and environments within one cluster.
  • Cluster-wide resources (nodes, PVs) are not namespaced.
  • Use quotas to stop one team from consuming the cluster.
Share this post:

Comments (0)

Please login or register to comment.