Skip to content

Kubernetes Namespaces

Creating Imperatively

kubectl create ns dev-ns

Getting and Describing

kubectl get namespace
NAME              STATUS   AGE
default           Active   13m
dev               Active   2m35s
finance           Active   2m35s
kube-node-lease   Active   13m
kube-public       Active   13m
kube-system       Active   13m
manufacturing     Active   2m35s
marketing         Active   2m35s
prod              Active   2m35s
research          Active   2m35s

Specify a Namespaces

kubectl get pods --namespace research
NAME    READY   STATUS      RESTARTS   AGE
dna-1   0/1     Completed   3          51s
dna-2   0/1     Completed   5          3m38s

See the pods in all namespaces

Including 'greping' for a specific name too...

kubectl get pods --all-namespaces
kubectl get pods --all-namespaces | grep blue

Check for a service

kubectl -n dev get svc