kubectl Namespaces commands

14 commands in 2 groups: Manage, List & Inspect. Click or tap any command to copy it. Official documentation: kubernetes.io.

Open in the interactive cheat sheet search, stars and every other section

Manage

Create and remove namespaces from the cluster.
kubectl apply -f namespace.yaml
Apply namespace from manifest
kubectl create namespace <name>
Create a new namespace
kubectl delete namespace <name>
Delete a namespace and all its resources
kubectl label namespace <name> <key>-
Remove a label from a namespace
kubectl label namespace <name> <key>=<value>
Add or update a label on a namespace

List & Inspect

List namespaces and inspect their resources, quotas, and limits.
kubectl describe namespace <name>
Namespace details and resource quotas
kubectl describe resourcequota -n <namespace>
Current quota usage vs limits
kubectl get namespaces
List all namespaces
kubectl get ns
Short alias for get namespaces
kubectl get all -A
Common workload resources across all namespaces (not ConfigMaps, Secrets, PVCs)
kubectl get all -n <namespace>
Common workload resources in a namespace (not ConfigMaps, Secrets, PVCs)
kubectl get limitrange -n <namespace>
Default CPU/memory limits for namespace
kubectl get namespace <name> -o yaml
Get namespace manifest as YAML
kubectl get resourcequota -n <namespace>
Resource quotas for a namespace