- Namespaces provide a mechanism for isolating groups of resources within a single cluster.
- Namespace-based scoping is applicable only for namespaced objects (e.g. Deployments, Services, etc) and not for cluster-wide objects (e.g. StorageClass, Nodes, PersistentVolumes, etc).
- Names of resources need to be unique within a namespace, but not across namespaces.
show
kubectl get namespacesshow
kubectl create namespace alphashow
kubectl get pods --namespace=alpha
# OR
kubectl get pods -n=alphashow
kubectl get pods --all-namespaces
#OR
kubectl get pods -Ashow
kubectl label namespace alpha type=critical
kubectl get namespace alpha --show-labels
# NAME STATUS AGE LABELS
# alpha Active 70s type=criticalshow
kubectl delete namespace alpha