Bryon
Bryon

Reputation: 1017

How to stop a self-built kubernetes cluster

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

Upvotes: 2

Views: 6920

Answers (1)

Anlis
Anlis

Reputation: 849

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

Upvotes: 4

Related Questions