The steps
- Taint the node
- Cordon the node
- Evict pods
- Verify pod migration
- Drain the node
- Uncordon the node
Traint the specific node
1# prevent new pods to schedule
2kubectl taint nodes node1 node.kubernetes.io/unreachable="":NoSchedule
3kubectl cordon node1
4# execute the upgrade or other maintenance
5# evict pods
6kubectl drain node1 --ignore-daemonsets --delete-emptydir-data --force
7#
8kubectl uncordon node1
9
10# verify the pods can schedule
11kubectl get pods -o wide --field-selector spec.nodeName=node1