Drill: Safely Drain a Kubernetes Node¶
Goal¶
Perform a safe node drain workflow: cordon the node, check PodDisruptionBudgets, drain, and verify workloads moved.
Setup¶
- kubectl configured with cluster access
- A multi-node cluster with workloads running
- Appropriate RBAC permissions for node operations
Commands¶
Check current node status:
Check what is running on the target node:
Cordon the node (prevent new scheduling):
Verify node shows SchedulingDisabled:
Check PodDisruptionBudgets that may block the drain:
Perform the drain:
If pods without controllers exist, add force:
Verify pods moved to other nodes:
Uncordon when maintenance is complete:
What to Look For¶
- After cordon, node status shows
SchedulingDisabled - PDB violations block drain with explicit error messages
- DaemonSet pods remain on the node (expected with
--ignore-daemonsets) - Workload pods should appear on other nodes after drain completes
Common Mistakes¶
- Draining without checking PDBs first, causing the drain to hang
- Forgetting
--ignore-daemonsets, which causes drain to fail on every node - Using
--forcewithout understanding it deletes pods not managed by a controller - Forgetting to uncordon the node after maintenance