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 usage 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
Cordon a Node and evict its Pods (DaemonSet Pods stay)
kubectl drain <node> --force --ignore-daemonsets
Force drain (removes unmanaged Pods)
kubectl drain <node> --ignore-daemonsets --delete-emptydir-data
Drain even Pods with emptyDir (their data is deleted)
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 Pods using taints, organize Nodes with labels and store metadata in 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 IPs, OS image, kernel version, container runtime