How to stop a kubernetes cluster?

Viacheslav Babanin picture Viacheslav Babanin · Oct 19, 2017 · Viewed 29.6k times · Source

I started the claster on a Google compute engine with the help of a kube-up.sh. This script created the master node and minion group. After i dont need it anymore i want to stop a cluster and shutdown all VMs in order not waste money for working of instanses. When i shutdown it (i just shut down all my cluster VMs, because i dont know another way to do it) and then start again in some time my cluster wont work anymore. "kubectl get nodes" dispalays not correct information about nodes ( For example i have A B C nodes == minions, it displays only D that even does not exist) and all comands works very very slow. Maybe i shutdown it not correct. How propery stop cluster and stop VMs in order to start it again in some time? (not delete)

What cluster i have:

kubernetes-master             | us-central1-b
kubernetes-minion-group-nq7f  | us-central1-b
kubernetes-minion-group-gh5k  | us-central1-b

What displays "kubectl get nodes" command:

[root@common frest0512]# kubectl get nodes
NAME                           STATUS                     AGE       VERSION
kubernetes-master              Ready,SchedulingDisabled   7h        v1.8.0
kubernetes-minion-group-02s7   Ready                      7h        v1.8.0
kubernetes-minion-group-92rn   Ready                      7h        v1.8.0
kubernetes-minion-group-kn2c   Ready                      7h        v1.8.0

Before shutdowning master node it was displayed correct (names and count of minions were the same).

Answer

Teoman shipahi picture Teoman shipahi · Dec 13, 2018

Thanks to Carlos for the tip.

You can follow steps below to detach all active nodes from Kubernetes cluster.

1- Go to Kubernetes Engine dashboard and select the cluster.
https://console.cloud.google.com/kubernetes

enter image description here

2- Go to details and click edit, set pool size to zero (0).

enter image description here

3- Validate nodes are shutting down at Compute Engine dashboard
https://console.cloud.google.com/compute

enter image description here