auto scale k8s pod based on moment in a day

7/13/2018

I want to achieve the following, suppose I've enough resource (CPU/node pool): During UTC 00:00 to UTC 3:00, pod replicas=10 During UTC 3:01 to UTC 23:59, pod replicas=3.

And if possible, change node pool size accordingly as well. I checked documentation, and looks like I only have CPU utilization trigger, yet the CPU usage of my running pod is quite low, 1% roughly, and there is no 'full workload' concept.

-- tikael
google-cloud-platform
kubernetes

1 Answer

7/16/2018

Inside GCP you can use Compute Engine and run your own VM instances, or use a Kubernetes Engine to create a cluster. Depending on which you use, you can autoscale them:

Scaling Based on Stackdriver Monitoring Metrics

You can use these GCP docs on how to install stackdriver agent manually and choose the desired metrics for memory monitoring. Keep in mind that stackdriver is available for premium tier accounts

Autoscale for cluster inside Kubernetes Engine

Inside Kubernetes Engine you can choose the cluster autoscaler.

Note that cluster autoscaler works based on Pod resource requests, that is, how many resources your Pods have requested. Cluster autoscaler does not take into account the resources your Pods are actively using. Essentially, cluster autoscaler trusts that the Pod resource requests you've provided are accurate and schedules Pods on nodes based on that assumption.

-- Crou
Source: StackOverflow