Cluster operationsLesson 3 of 16
Draining Nodes and Upgrading the Cluster
We are upgrading a 1.33 cluster to 1.34. Three web Pods are spread over three worker nodes, with a promise that "at least 2 web Pods must stay up". Follow how that promise is kept while each node is emptied and upgraded in turn.
Version1.33
Node in progress—
Ready web Pods3
RequestResponse / reportAppears in a later step
What you will learn
- Why the control plane goes first
- The difference between cordon and drain
- Drain deletes and recreates; it does not move
- How a PDB makes drain wait
Common misconceptions about upgrades
| Misconception | Reality |
|---|---|
| You can jump straight to the latest version | Minor versions go up one step at a time |
| Drain moves Pods with zero downtime | It deletes them and recreates them elsewhere; a single replica means an outage |
| A PDB protects you against node failure | A PDB only applies to voluntary maintenance like drain |
| If the engine upgrade succeeds, apps are fine | Deployments using APIs removed in the new version fail on their next deploy |
Try it yourself
kubectl version # Server (control plane) version
kubectl get nodes # Per-node kubelet VERSION, SchedulingDisabled
kubectl get pdb -A # ALLOWED DISRUPTIONS 0 stalls drain
kubectl get pods -A -o wide --field-selector spec.nodeName=<node> # Pods on that node
kubectl drain <node> --ignore-daemonsets --dry-run=client # Preview evictions, changes nothing
Check yourself
Further reading: Safely Drain a Node · Disruptions · Upgrading kubeadm clusters