horizo​​ntalpodautoscaler的最小和最大副本为1,创建2个容器

时间:2019-04-20 10:58:59

标签: kubernetes

我正在尝试运行horizo​​ntalpodautoscaler资源,将混合和最大副本定义为1。 一旦它开始运行,它将以某种方式同时运行2个pod实例,然后终止1个pod。 结束状态,我有1个Pod正在运行。

这是HPA资源的正常行为吗,它以某种方式创建了具有2个Pod的副本集,即使最大为1个

谢谢

2 个答案:

答案 0 :(得分:0)

通常不会发生。如果hpa目标指标target太低并且启动应用程序超出目标CPU阈值导致Pod扩展,则可能发生这种情况的唯一原因。

您可以检查HPA状态,events section可以解释扩展的原因。

HPA状态: kubectl描述HPA_NAME

检查以下示例以供参考

    Metrics:                                               ( current / target )
  resource cpu on pods  (as a percentage of request):  40% (406m) / 50%
Min replicas:                                          10
Max replicas:                                          100
Conditions:
  Type            Status  Reason              Message
  ----            ------  ------              -------
  AbleToScale     True    ReadyForNewScale    the last scale time was sufficiently old as to warrant a new scale
  ScalingActive   True    ValidMetricFound    the HPA was able to succesfully calculate a replica count from cpu resource utilization (percentage of request)
  ScalingLimited  False   DesiredWithinRange  the desired replica count is within the acceptible range
Events:
  Type    Reason             Age                   From                       Message
  ----    ------             ----                  ----                       -------
  Normal  SuccessfulRescale  35m (x1216 over 12d)  horizontal-pod-autoscaler  New size: 10; reason: All metrics below target


答案 1 :(得分:0)

这些是来自所有相关资源的事件:

for /?