Securely shutdown a node from kubernetes cluster

7/25/2018

I've a running kubernetes(v1.11.1) cluster consisting of three nodes. I need to remove a node from the cluster properly. What should be the proper way to do that? I've used kubeadm to create the cluster.

-- Ratul
kubeadm
kubernetes
kubernetes-cluster

1 Answer

7/25/2018

Always drain the node before removing it:

kubectl drain $NODE

Draining evicts every pod in the node and cordons it, so no new pods will be scheduled in it.

You can use these parameters to 'force' draining, overriding some restrictions:

kubectl drain $NODE --force=true --delete-local-data=true --ignore-daemonsets=true

Find further info here:

https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/

-- Ignacio Millán
Source: StackOverflow