OnCallReady

Commands

kubectl drain - Drain node in preparation for maintenance

kubectl drain NODE [--ignore-daemonsets] [--delete-emptydir-data] [--force] [--grace-period=N] [--timeout=D] [--disable-eviction]

Options you will use

--ignore-daemonsets
DaemonSet pods would be recreated on the node anyway: skip them
--delete-emptydir-data
evict pods with emptyDir volumes (their data is lost)
--force
also delete pods with no controller (they are gone for good)
--timeout=D
give up after D (default: wait forever)
--disable-eviction
DELETE instead of evict: bypasses PodDisruptionBudgets. Last resort.

Examples

$ kubectl drain worker-1 --ignore-daemonsets --delete-emptydir-data

the standard maintenance drain

$ kubectl uncordon worker-1

allow scheduling again afterwards

Gotchas

Taught in

Try kubectl drain in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.