Is there any tool for GKE nodes autoscaling base on total pods requested in kubernetes?

2/23/2016

When I resize a replication controller using kubectl, if the cluster does not have enough resource, there will have one or more pods always in pending.

Is there has any tool will auto resize GKE cluster when the resource is running out?

-- Gianluigi
autoscaling
google-kubernetes-engine
kubernetes

2 Answers

3/3/2016

I had a similar requirement (for the Go build system): wanted to know when scheduled vs. available CPU or memory was > 1, and scale out nodes when that was true (or, more accurately, when it was ~.8). There's not a built-in metric, but as you suggest you can do it with a custom metric.

This was all done in Go, but it will give you the basic idea:

  1. Create the metrics (memory and CPU, in my case
  2. Put values to the metrics

The key takeaway IMO is that you have to iterate over each pod in the cluster to determine how much capacity is consumed, then iterate over each node in the cluster to determine how much capacity is available. It's then just a matter of pointing your autoscaler to the custom metric(s).

Big big big thing worth noting: I ultimately determined that scaling on the built-in CPU utilization metric was just as good as (if not better than, but more on that in a bit) than the custom metric. Each pod we scheduled pegged the CPU, so when pods were maxed out so was CPU. The build-in CPU utilization metric is probably better because you don't have the latency that comes with periodically putting custom metrics.

-- Evan Brown
Source: StackOverflow

2/23/2016

You can turn on autoscaling for the Instance Group that your GKE nodes belong to.

-- Vishnu Kannan
Source: StackOverflow