Skip to content

Latest commit

 

History

History
95 lines (58 loc) · 1.51 KB

namespaces.md

File metadata and controls

95 lines (58 loc) · 1.51 KB
  • 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.

Check the namespaces on the cluster


show

kubectl get namespaces


Create namespace named alpha


show

kubectl create namespace alpha


Get pods from alpha namespace


show

kubectl get pods --namespace=alpha
# OR 
kubectl get pods -n=alpha


Get pods from all namespaces


show

kubectl get pods --all-namespaces
#OR 
kubectl get pods -A


Label namespace alpha with label type:critical


show

kubectl label namespace alpha type=critical

kubectl get namespace alpha --show-labels
# NAME    STATUS   AGE   LABELS
# alpha   Active   70s   type=critical

Delete namespace alpha


show

kubectl delete namespace alpha