Kubernetes horizontal pod autoscaling initial delay?
Asked Answered
D

1

7

Is there a configuration in Kubernetes horizontal pod autoscaling to specify a minimum delay for a pod to be running or created before scaling up/down?

For example with something like:

# I am looking for a flag like this
--horizontal-pod-autoscale-initial-upscale-delay=5m0s

# Similar to these existing flags
--horizontal-pod-autoscaler-downscale-delay=2m0s
--horizontal-pod-autoscaler-upscale-delay=2m0s

Having as a result:

  • Wait for 5 min before any upscale occur
  • After 5 min, perform a downscale at most every 2 min

I have a situation where a Pod consumes lots of resources on start-up for bootstrapping (which is expected) but I don't want it scaled during this time, and once bootstrap is done it may be eligible for autoscaling.

Detumescence answered 6/8, 2019 at 12:21 Comment(0)
B
7

This flag actually exists: --horizontal-pod-autoscaler-cpu-initialization-period In addition you need to consider the readiness delay: --horizontal-pod-autoscaler-initial-readiness-delay and the metric loop time, --horizontal-pod-autoscaler-sync-period to calculate the total (max/min/average) delay.

See https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/

Biak answered 6/8, 2019 at 14:42 Comment(6)
Thanks, I missed that one. Formulation is quite confusing though. Issue github.com/kubernetes/website/issues/12657 is pointing at thatDetumescence
@Biak How to define it in yaml?Excessive
In addition to the comment from @RonakPatel, do you know where the flags should be provided in CLI? kubectl autoscale doesn't seem to accept them.Jeraldinejeralee
These flags are applied globally to the cluster and cannot be configured per HPA object. If you're using a hosted Kubernetes solution, they are most likely configured by the provider.Prosector
Sadly enough neither of those two parameters (horizontal-pod-autoscaler-cpu-initialization-period, horizontal-pod-autoscaler-initial-readiness-delay) are available in OpenShift 3.11Countermark
If you are using CPA-HPA instead of standard HPA, the equivalent command as YAML for initial readiness is initialReadinessDelay - horizontal-pod-autoscaler.readthedocs.io/en/latest/user-guide/… But, again, this is not for standard HPA. CPA-HPA is almost a drop-in replacement for HPA.Moderation

© 2022 - 2024 — McMap. All rights reserved.