kubectl-drain
evicts pods from a node for maintenance
TLDR
Drain node
SYNOPSIS
kubectl drain [options] node
DESCRIPTION
kubectl drain safely evicts all pods from a node in preparation for maintenance operations such as kernel upgrades, hardware repairs, or Kubernetes version updates. It first cordons the node to prevent new pods from being scheduled, then uses the Eviction API to gracefully terminate each pod, allowing their controllers to reschedule them onto other available nodes.
The command respects PodDisruptionBudgets (PDBs), which means it will block if evicting a pod would violate the application's availability requirements. DaemonSet-managed pods are not evicted by default since they are expected to run on every node; use `--ignore-daemonsets` to proceed without error. Pods with local storage (emptyDir volumes) also require explicit acknowledgment via `--delete-emptydir-data`, as their data will be lost.
After maintenance is complete, the node must be uncordoned with `kubectl uncordon` to resume accepting new pod scheduling. A `--timeout` flag allows setting a maximum wait time for the drain to complete before it is aborted.
PARAMETERS
NODE
Node name to drain.--ignore-daemonsets
Ignore DaemonSet pods.--force
Continue despite errors.--delete-emptydir-data
Delete emptyDir data.--timeout DURATION
Drain timeout.--grace-period N
Pod termination grace.--help
Display help information.
CAVEATS
Subcommand of kubectl. Respects PDBs. Use uncordon to restore.
HISTORY
kubectl drain provides safe node evacuation for Kubernetes cluster maintenance operations.
SEE ALSO
kubectl(1), kubectl-cordon(1), kubectl-uncordon(1)
