Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop a kubernetes cluster?

Tags:

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).

like image 707
Vyacheslav Babanin Avatar asked Oct 19 '17 20:10

Vyacheslav Babanin


2 Answers

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

like image 191
Teoman shipahi Avatar answered Sep 16 '22 14:09

Teoman shipahi


Unless I'm misunderstanding, it sounds like you're trying to kill the cluster by stopping the VMs individually through Compute Engine. If so, Container Engine is going to see that the VMs have been killed, and start new ones in their place to keep the cluster healthy. If you want to stop the cluster, you have to do so through the Container Engine interface. In this way, it will know that killing the nodes wasn't a mistake, and it will shut down all provisioned VMs and disks.

like image 22
sanche Avatar answered Sep 18 '22 14:09

sanche