3

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
  • 453
  • 7
  • 15

1 Answers1

6

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
  • 7,480
  • 1
  • 25
  • 28
  • This doesn't answer the OP's question of how to remove the node from the cluster, it merely says what needs to be done in preparation for "safely" removing it. In my case, I haven't started any pods on the cluster: I discovered another team member had a conflicting program running on a machine I thought I could use in the cluster, now I need to remove the node without having fully brought the cluster up yet. This answer provides *zero* information about how to do that. – FKEinternet Sep 15 '20 at 05:13