Is there any tool for GKE nodes autoscaling base o

2019-05-04 08:41发布

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?

2条回答
Explosion°爆炸
2楼-- · 2019-05-04 09:18

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.

查看更多
爷的心禁止访问
3楼-- · 2019-05-04 09:18

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

查看更多
登录 后发表回答