How to stop gcloud container engine clusters

pazams picture pazams · Jul 12, 2016 · Viewed 20.3k times · Source

I use gcloud to provision kubernetes clusters, and use container engine to do so.

Aside from the production cluster, I would like to create short-lived clusters, for testing etc'.

Instead of recreating clusters, I would like to have a test cluster and be able to stop/start on demand. Trying to hit "stop" on the vm instances listed at compute engine will make them restart eventually.

What is the proper way to stop & start a test cluster?

The motivation for short lived test clusters is from cost consideration.

Answer

Alex Robinson picture Alex Robinson · Jul 12, 2016

You can temporarily scale the number of nodes in your cluster down to zero by running:

gcloud container clusters resize $CLUSTER_NAME --num-nodes=0

Then scale it back up later by running that with a non-zero value for the size flag.