问题描述
我正在寻找有关如何基于自定义指标自动缩放Pod的指针.
I am looking for pointers on how to autoscale pods based on custom metrics.
随着传入的HTTP请求数量的增加,我希望我的GKE吊舱能够自动缩放以处理负载.
As the number of incoming http requests increase, I would like my GKE pods to autoscale to handle the load.
实现此目标的最佳方法是什么?
What is the best way to achieve this ?
推荐答案
默认情况下,GKE中的HPA使用CPU进行缩放(基于资源请求与实际使用情况).但是,您也可以使用自定义指标,只需遵循本指南.在您的情况下,让自定义指标跟踪每个Pod的HTTP请求数(不要使用对LB的请求数).
By default, HPA in GKE uses CPU to scale up and down (based on resource requests Vs actual usage). However, you can use custom metrics as well, just follow this guide. In your case, have the custom metric track the number of HTTP requests per pod (do not use the number of requests to the LB).
请确保在使用自定义指标时,您选择使用的值将是所有Pod的平均值,这样,数量会随Pod的数量而增加或减少.如果您选择的指标不受所含广告连播数量的影响,则您的HPA将始终保持在最大或最小的广告连播数量.
Make sure when using custom metrics, that the value you choose to use will be an average across all pods, this way the number will increase or decrease with the number of pods. If you choose a metric that is no affected by the number of pods you have, your HPA will either always be at the maximum or the minimum number of pods.
这篇关于根据http请求计数自动缩放Pod的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!