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 ResourceQuotas
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 resources across all Namespaces: Pods, Services, workloads (not ConfigMaps, Secrets, PVCs)
kubectl get all -n <namespace>
Common resources in a Namespace: Pods, Services, workloads (not ConfigMaps, Secrets, PVCs)
kubectl get limitrange -n <namespace>
List LimitRanges (describe shows the default CPU/memory limits)
kubectl get namespace <name> -o yaml
Get Namespace manifest as YAML
kubectl get resourcequota -n <namespace>
ResourceQuotas for a Namespace