CmdID

CmdID / Commands

kubectl-drain

Drain a node in preparation for maintenance by marking it unschedulable and evicting all pods. tldr-pages

On several platforms

Opens CmdID with your command. It is read in your browser and sent nowhere.

Several platforms

from tldr-pages, CC BY 4.0

Drain a node

kubectl drain node_nameIdentify

Drain a node, ignoring DaemonSet-managed pods

kubectl drain node_name --ignore-daemonsetsIdentify
--ignore-daemonsetsIgnore DaemonSet-managed pods. kubectl reference

Drain a node and delete pods using emptyDir volumes (local data will be lost)

kubectl drain node_name --ignore-daemonsets --delete-emptydir-dataIdentify
--ignore-daemonsetsIgnore DaemonSet-managed pods. kubectl reference
--delete-emptydir-dataContinue even if there are pods using emptyDir (local data that will be deleted when the node is drained). kubectl reference

Drain a node, forcing eviction of pods not managed by a controller

kubectl drain node_name --forceIdentify
--forceContinue even if there are pods that do not declare a controller. kubectl reference

Drain a node with a custom grace period for pod termination

kubectl drain node_name --grace-period secondsIdentify
--grace-periodPeriod of time in seconds given to each pod to terminate gracefully. kubectl reference

Drain a node, evicting only pods that match a label selector

kubectl drain node_name --pod-selector label_key=label_valueIdentify
--pod-selectorLabel selector to filter pods on the node kubectl reference

Drain a node with a timeout

kubectl drain node_name --timeout durationIdentify
--timeoutThe length of time to wait before giving up, zero means infinite kubectl reference

Simulate the drain operation without actually evicting pods

kubectl drain node_name --dry-run=noneIdentify
--dry-runMust be "none", "server", or "client". kubectl reference