kubectl Nodes commands

28 commands in 4 groups: Resource Usage, Scheduling, Taints, Labels & Annotations, 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

Resource Usage

Monitor real-time CPU and memory consumption across nodes and pods.
kubectl top node <name>
CPU and memory usage for a specific node
kubectl top nodes
CPU and memory usage per node
kubectl top nodes --sort-by=cpu
Nodes sorted by CPU usage
kubectl top nodes --sort-by=memory
Nodes sorted by memory usage
kubectl top pods -A
CPU and memory for all pods
kubectl top pods -n <namespace> --sort-by=cpu
Pods sorted by CPU usage
kubectl top pods -n <namespace> --sort-by=memory
Pods sorted by memory usage

Scheduling

Control which nodes accept new workloads using cordon, uncordon, and drain.
kubectl cordon <node>
Mark node as unschedulable
kubectl drain <node> --ignore-daemonsets
Evict all pods from a node
kubectl drain <node> --force --ignore-daemonsets
Force drain (removes unmanaged pods)
kubectl drain <node> --ignore-daemonsets --delete-emptydir-data
Drain including emptyDir pods
kubectl drain <node> --ignore-daemonsets --dry-run=client
Simulate drain without evicting any pods
kubectl uncordon <node>
Mark node as schedulable again
kubectl wait --for=condition=Ready node/<name> --timeout=60s
Wait until node becomes Ready

Taints, Labels & Annotations

Repel or attract pods using taints; organise nodes with labels and store metadata via annotations.
kubectl annotate node <node> <key>-
Remove an annotation from a node
kubectl annotate node <node> <key>=<value>
Add or update a node annotation
kubectl get nodes -l <key>=<value>
Filter nodes by label
kubectl label nodes <node> <key>-
Remove a label from a node
kubectl label nodes <node> <key>=<value>
Add a label to a node
kubectl taint nodes <node> <key>:NoSchedule-
Remove a taint from node
kubectl taint nodes <node> <key>=<value>:NoExecute
Add NoExecute taint to node
kubectl taint nodes <node> <key>=<value>:NoSchedule
Add NoSchedule taint to node

List & Inspect

View node details, status, internal IP, OS, and container runtime version.
kubectl describe node <name>
Node details, conditions, capacity
kubectl get nodes
List all nodes in the cluster
kubectl get node <name> -o yaml
Get node manifest as YAML
kubectl get nodes --show-labels
Nodes with all their labels
kubectl get nodes -o custom-columns=NAME:.metadata.name,VER:.status.nodeInfo.kubeletVersion,OS:.status.nodeInfo.osImage
Custom columns: name, version, and OS
kubectl get nodes -o wide
Nodes with IP, OS, architecture, container runtime