Sometimes we need to remove worker nodes from Kubernetes cluster due to some reason. Here is the steps to remove the worker node from Kubernetes Cluster.

Step 1:

Get the node name which needs to remove from cluster,

# kubectl get nodes



Step 2:

Drain the node from cluster,

# kubectl drain <node-name>

If you want to ignore daemonsets and local-data in the machine, use below command,

# kubectl drain <node-name> --ignore-daemonsets --delete-local-data



After executed drain command, check all the pods are moved to another node and its running fine.

check the node status now,

# kubectl get nodes



Step 3 :

Now delete the node from cluster,

# kubectl delete node <node-name>




That's all, now the worker node is safely removed from the cluster.

Post a Comment

Previous Post Next Post