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.122
Note: 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
For additional information about draining the node, see the help for the
kubectl drain
command by entering:kubectl help drain
. Because the node was already marked as unschedulable, the pods from theReplicationController
,ReplicaSet
,Job
, andStatefulSet
deployments are not scheduled to this node. The scheduler moves all workloads to another node that is schedulable.Note: Draining the node from the
DaemonSet
deployment 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.