How to stop a self-built kubernetes cluster

12/29/2018

Does anyone know the correct procedure to bring down a kubernetes cluster gracefully? I have K8s 1.12 running on bare metal (built with kubeadm on Ubuntu 16.04) in a lab. I want to bring down the cluster gracefully before I shut down the servers. Strangely this is not documented - so maybe that is handled when the system services are stopped; but I want to check. Thanks

-- Bryon
kubernetes
ubuntu

1 Answer

12/29/2018

The tear down section of the official documentation says:

To undo what kubeadm did, you should first drain the node and make sure that the node is empty before shutting it down.

Talking to the master with the appropriate credentials, run:

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

Then, on the node being removed, reset all kubeadm installed state:

kubeadm reset
-- Andellys
Source: StackOverflow