desiredReplicas = ceil[currentReplicas * ( currentMetricValue / desiredMetricValue )]
currentMetricValue 为相关 pod 的 metric 平均数。
If multiple metrics are specified in a HorizontalPodAutoscaler, this calculation is done for each metric, and then the largest of the desired replica counts is chosen.
Just before HPA scales the target, the scale recommendation is recorded. The controller considers all recommendations within a configurable window choosing the highest recommendation from within that window.
--horizontal-pod-autoscaler-sync-periodflag (with a default value of 15 seconds) : control loop, with a period controlled by the controller manager
--horizontal-pod-autoscaler-tolerance： We’ll skip scaling if the ratio is sufficiently close to 1.0 (within a globally-configurable tolerance, defaults to 0.1
--horizontal-pod-autoscaler-initial-readiness-delay： Due to technical constraints, the HorizontalPodAutoscaler controller cannot exactly determine the first time a pod becomes ready when determining whether to set aside certain CPU metrics. Instead, it considers a Pod “not yet ready” if it’s unready and transitioned to unready within a short, configurable window of time since it started. This value is configured with the
--horizontal-pod-autoscaler-initial-readiness-delayflag, and its default is 30 seconds
--horizontal-pod-autoscaler-cpu-initialization-period： Once a pod has become ready, it considers any transition to ready to be the first if it occurred within a longer, configurable time since it started. This value is configured with the
--horizontal-pod-autoscaler-cpu-initialization-periodflag, and its default is 5 minutes.
--horizontal-pod-autoscaler-downscale-stabilization: just before HPA scales the target, the scale recommendation is recorded. The controller considers all recommendations within a configurable window choosing the highest recommendation from within that window. This value can be configured using the
--horizontal-pod-autoscaler-downscale-stabilizationflag, which defaults to 5 minutes. This means that scaledowns will occur gradually, smoothing out the impact of rapidly fluctuating metric values.
Kubernetes v1.20 的支持。