mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
1.4 KiB
1.4 KiB
Drain nodes in K8S clusters
Table of contents
TL;DR
-
Cordon the Nodes.
This marks each Node as unschedulable and prevents new Pods to start on them.$ kubectl cordon 'kworker-rj2' node/kworker-rj2 cordoned -
Drain the nodes.
This evicts Pods already running on the Nodes.$ kubectl drain 'kworker-rj2' --grace-period=300 --ignore-daemonsets=true node/kworker-rj2 already cordoned WARNING: ignoring DaemonSet-managed Pods: kube-system/calico-node-fl8dl, kube-system/kube-proxy-95vdf evicting pod default/my-dep-557548758d-d2pmd pod/my-dep-557548758d-d2pmd evicted node/kworker-rj2 evicted -
Do to the Nodes what you need to do.
-
Uncordon the Nodes. This makes them available for scheduling again.
$ kubectl uncordon 'kworker-rj2' node/kworker-rj2 uncordoned
Further readings
Sources
All the references in the further readings section, plus the following: