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

雨燕双飞 提交于 2019-12-07 08:32:35

问题


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?


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/35572689/is-there-any-tool-for-gke-nodes-autoscaling-base-on-total-pods-requested-in-kube

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!