Horizon Setup V2 5 3 0 22
The HorizontalPodAutoscaler is implemented as a Kubernetes API resource and acontroller.The resource determines the behavior of the controller.The horizontal pod autoscaling controller, running within the Kubernetescontrol plane, periodically adjusts thedesired scale of its target (for example, a Deployment) to match observed metrics such as averageCPU utilization, average memory utilization, or any other custom metric you specify.
Horizon Setup V2 5 3 0 22
Kubernetes implements horizontal pod autoscaling as a control loop that runs intermittently(it is not a continuous process). The interval is set by the--horizontal-pod-autoscaler-sync-period parameter to thekube-controller-manager(and the default interval is 15 seconds).
Due to technical constraints, the HorizontalPodAutoscaler controllercannot exactly determine the first time a pod becomes ready whendetermining whether to set aside certain CPU metrics. Instead, itconsiders a Pod "not yet ready" if it's unready and transitioned toready within a short, configurable window of time since it started.This value is configured with the --horizontal-pod-autoscaler-initial-readiness-delay flag, and its default is 30seconds. Once a pod has become ready, it considers any transition toready to be the first if it occurred within a longer, configurable timesince it started. This value is configured with the --horizontal-pod-autoscaler-cpu-initialization-period flag, and itsdefault is 5 minutes.
Finally, right before HPA scales the target, the scale recommendation is recorded. Thecontroller considers all recommendations within a configurable window choosing thehighest recommendation from within that window. This value can be configured using the --horizontal-pod-autoscaler-downscale-stabilization flag, which defaults to 5 minutes.This means that scaledowns will occur gradually, smoothing out the impact of rapidlyfluctuating metric values.
For scaling down the stabilization window is 300 seconds (or the value of the--horizontal-pod-autoscaler-downscale-stabilization flag if provided). There is only a single policyfor scaling down which allows a 100% of the currently running replicas to be removed whichmeans the scaling target can be scaled down to the minimum allowed replicas.For scaling up there is no stabilization window. When the metrics indicate that the target should bescaled up the target is scaled up immediately. There are 2 policies where 4 pods or a 100% of the currentlyrunning replicas will be added every 15 seconds till the HPA reaches its steady state.