I\'m creating a HorizontalPodAutoscaler in Kubernetes and I need to configure the downscale stabilization window to be smaller than the default. The code used and error are belo
The Doc has updated it to v1.18 starting to behavior field
Support for configurable scaling behavior Starting from v1.18 the v2beta2 API allows scaling behavior to be configured through the HPA behavior field. Behaviors are specified separately for scaling up and down in scaleUp or scaleDown section under the behavior field. A stabilization window can be specified for both directions which prevents the flapping of the number of the replicas in the scaling target. Similarly specifying scaling policies controls the rate of change of replicas while scaling.
So it looks like this was a case of incorrect documentation that was corrected shortly after I asked my question. PR #18157 on kubernetes/website
adds the following text to the page on the Horizontal Pod Autoscaler.
Starting from v1.17 the downscale stabilization window can be set on a per-HPA basis by setting the
behavior.scaleDown.stabilizationWindowSeconds
field in the v2beta2 API. See Support for configurable scaling behavior.
PR #18965 reverts the previous pull request since the behavior
object is functionality targeted in 1.18, not 1.17.
For now, the solution is to use the --horizontal-pod-autoscaler-downscale-stabilization
flag on the controller manager as mentioned in @ShantyMan's answer above which will set the value for every HPA.
You read the docs incorrectly. There is no such object like behavior
thus the error why applying the yaml
and that's why it's missing from Api reference.
Here you have details regarding the algorithm that is being used for scaling.
But I think you are thinking about this Support for cooldown/delay
--horizontal-pod-autoscaler-downscale-stabilization
: The value for this option is a duration that specifies how long the autoscaler has to wait before another downscale operation can be performed after the current one has completed. The default value is 5 minutes (5m0s).Note: When tuning these parameter values, a cluster operator should be aware of the possible consequences. If the delay (cooldown) value is set too long, there could be complaints that the Horizontal Pod Autoscaler is not responsive to workload changes. However, if the delay value is set too short, the scale of the replicas set may keep thrashing as usual.