Stop and restart kubernetes nodes

4/16/2021

I have four nodes

kubectl get nodes

NAME            STATUS     AGE
adm-1   Ready      42s
adm-2   Ready      42s
adm-3   Ready      42s

So I want to stop these nodes temporarily, then restart them again

Note-This is not a GKE cluster

-- user15224751
kubernetes

1 Answer

4/16/2021

A node can also be marked as unschedulable and drained manually. Without going into specifics, this is done with the following kubectl commands.

kubectl cordon <node> # marks the node as unschedulable (but doesn’t do anything with pods running on that node).

kubectl drain <node> # marks the node as unschedulable and then evicts all the pods from the node.

So try drain options in your case.

Note: In both cases, no new pods are scheduled to the node until you uncordon it again with kubectl uncordon <node>.

-- Gupta
Source: StackOverflow