drain
Cordoning a node and then evicting its pods through the eviction API so it can be safely maintained or removed.
In more detail
Because drain uses eviction, it respects PodDisruptionBudgets and can pause when evicting another pod would break a budget. DaemonSet pods are skipped with --ignore-daemonsets, and pods using emptyDir need --delete-emptydir-data. Controllers recreate the evicted pods elsewhere.
Example
kubectl drain node-a --ignore-daemonsetsRelated terms
- cordon — Marking a node unschedulable so no new pods are placed on it, while the pods already there keep running.
- uncordon — Marking a cordoned node as available for scheduling again so it can receive new pods.
- eviction — Removing a running pod from its node, either through the API during maintenance or by the kubelet when the node runs short of resources.
- PodDisruptionBudget — An object that limits how many pods of an application may be voluntarily taken down at once, such as during a node drain.
Taught in
- A Node Goes NotReady Forty Minutes In — Certified Kubernetes Administrator (CKA) Exam Prep
- Upgrades In The Only Order That Works — Certified Kubernetes Administrator (CKA) Exam Prep
- Placing Pods: Selectors, Affinity, Taints And Requests — Certified Kubernetes Administrator (CKA) Exam Prep
- Mock Exam: Seventeen Tasks Against The Clock — Certified Kubernetes Administrator (CKA) Exam Prep
- Taints, Tolerations And Disruption Budgets — Kubernetes: Production-Grade Container Orchestration
- kubeadm, High Availability And Cluster Lifecycle — Kubernetes: Production-Grade Container Orchestration
- Drain, Upgrade, Version Skew And Certificate Maintenance — Kubernetes: Production-Grade Container Orchestration