HPA stabilization window¶
In Kubernetes Horizontal Pod Autoscaler (HPA) configurations, the stabilization window is a parameter used to control the timing of scaling down operations.^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]
Behavior and Algorithm¶
When Metrics indicate that a target should be scaled down, the autoscaler does not immediately reduce the replica count to the calculated lower value. Instead, the algorithm reviews previously calculated desired states.^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]
Specifically, it looks at the states calculated within the time interval defined by the stabilization window. The system selects the maximum value among these historical desired states to be the effective target.^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]
Purpose¶
The primary function of the stabilization window is to prevent the replica count from fluctuating too frequently, a phenomenon often referred to as "thrashing" or jitter.^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md] By enforcing a wait period where the highest recent demand is preserved, it ensures that brief drops in load do not trigger an immediate scale-down that might be premature.
Configuration¶
The stabilization window is defined within the behavior field of an HPA resource, specifically under scaleDown.^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]
- Field:
spec.behavior.scaleDown.stabilizationWindowSeconds - Default: A common default value (often used in examples) is
300seconds (5 minutes).^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]
Related Concepts¶
- Kubernetes
- Horizontal Pod Autoscaler
- [[Scaling policies]]
Sources¶
^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]