I have kubernetes cluster that contains two node pools. I have a task to automate resizing node pools to 0 nodes on weekends to save the money. I know that I can stop the compute instances by standard schedule. But I can't stop the instances that are members of instance pools. I can only resize the pool to 0. How can I do that by gcloud schedule?
Asked
Active
Viewed 771 times
2
-
This is a much needed feature together with node-pool batch resizing option. – Nowa Concordia Aug 10 '20 at 07:06
2 Answers
0
Cloud scheduler won't allow you to resize the node pool. You can instead use Cloud scheduler along with Cloud Functions to call the container API to resize the node pool. There is an example on the Google public docs to do something like this for a compute instance, you'll have to convert the function call to use the container API instead.

Patrick W
- 4,603
- 1
- 12
- 26
-
Yes, I understand it. But how to convert? Please, show the example. I am not specialist in js... – malcolm Apr 02 '19 at 10:00
-
That I'm not 100% sure of. Alternatively, you could run a Cron job somewhere else that runs the gcloud command to resize your node pool It's not as elegant but much easier to handle if you're not good with js – Patrick W Apr 02 '19 at 18:38
0
Here are some possible solutions:
Use GKE to manage your cluster, so you can resizing-a-cluster or migration to different size machine.
Manage your own kubernetes cluster, uses a Compute Engine instance group for the nodes in your cluster, you can actually update it without needing GKE's help
If you want automation, you can use Jenkins or Airflow to schedule resizing jobs.
Hope this can help you.

howie
- 2,587
- 3
- 27
- 43