kubernetes autoscale minPods 与副本

kubernetes autoscale minPods vs replicas

相当新,正在了解 kubernetes。如果这是非常基本的,请道歉。

我公开了一个复制设置为 3 的服务。 当 CPU 运行超过 50% 时,我已使用 minPods=2maxPods=6 自动缩放部署。

NAME                 REFERENCE                       TARGETS           MINPODS   MAXPODS   REPLICAS   AGE

my-api   Deployment/ewealth-stocks-api   <unknown> / 50%   **2         6         3**          2m

以上配置有什么作用?当 CPU 在阈值内以及超过阈值时,有多少 pods 可用?谢谢

据我了解,您想根据 CPU 的用法使用 Horizontal Pod Autoscaler

所以基本上 HPA 将根据 CPU 负载复制 pods。这意味着当 CPU 负载大于 50% 时,将 pods 的副本数增加到 6。当 CPU 负载减少时,则保持 [=29] 的副本数=] 2.

由于不以任何方式控制负载量,因此最终的副本数可能会从 2 到 6 不等。

HPA will increase and decrease the number of replicas (via the deployment) to maintain an average CPU utilization across all Pods of 50% If you want to check state of CPU usage and numbers of pods then you use following commands

kubectl get hpa

kubectl describe hpa HPA_NAME

我附上了一个 link 以供进一步理解,其中提供了一个例子。

horizontal-pod-autoscale-walkthrough