Reduce Kubernetes Cluster costs at night

4/6/2018

I am using Google's Kubernetes Engine to manage a cluster with several node pools. Each pool has different configurations (ex. not all have auto-scaling).

The pools are mostly unused during the night, and so I would like to reduce resource consumption and cost during this period (about 10 hours).

I've considered stopping VM instances at the end of the day and restarting them in the morning. Additionally I could temporarily scale down the number of nodes by running gcloud container clusters resize $CLUSTER_NAME --size=0

What would be the best option to reduce costs during unused periods? Is there a better way?

-- Daniel André
gcloud
google-compute-engine
google-kubernetes-engine

1 Answer

4/18/2018

Using cluster autoscaler (which adjusts number of nodes in your node pools) will not be able to scale all your node pools to zero. This is because there are some system pods running in your cluster (kubectl get pods -n kube-system).

You can however, force scaling down of node pools to zero as you pointed out, with a script calling:

gcloud container clusters resize $CLUSTER --size=0 [--node-pool=$POOL]
-- AhmetB - Google
Source: StackOverflow