Node maintenance
To perform maintenance on a node, you can unschedule and drain a node.
-
Mark the node as unschedulable by running the following command:
kubectl cordon 9.111.255.122Note: Marking the node as unschedulable disables scheduling new pods on the node.
-
Drain the node in preparation for maintenance to remove pods that are running on the node by running the following command:
kubectl drain 9.111.255.122 --grace-period=300 --ignore-daemonsets=true --delete-local-dataFor more information, see the help for the
kubectl draincommand by entering:kubectl help drain. Because the node was already marked as unschedulable, the pods from theReplicationController,ReplicaSet,Job, andStatefulSetdeployments are not scheduled to this node. The scheduler moves all workloads to another node that is schedulable.Note: Draining the node from the
DaemonSetdeployment is not required. -
Exit maintenance by running the following command:
kubectl uncordon 9.111.255.122
Note: The alpha feature TaintNodesByCondition for kube-controller-manager on all master nodes is enabled by default.