- 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 namespaces
show
kubectl create namespace alpha
show
kubectl get pods --namespace=alpha
# OR
kubectl get pods -n=alpha
show
kubectl get pods --all-namespaces
#OR
kubectl get pods -A
show
kubectl label namespace alpha type=critical
kubectl get namespace alpha --show-labels
# NAME STATUS AGE LABELS
# alpha Active 70s type=critical
show
kubectl delete namespace alpha