HPA auto-scaling at deployment based on HTTP requests count

11/6/2019

I have an issue with HPA configuration, based on HTTP requests rate. I am using a rate based on a Prometheus metric - sum(rate(http_server_requests_seconds_count[5m])) - but at start-up HPA is auto-scaling to the maximum number of pods despite no HTTP requests being received. See extract below from kubectl describe hpa showing that it is scaling on the metric and this happens within seconds of the deployment.

Normal  SuccessfulRescale  23m (x4 over 128m)   horizontal-pod-autoscaler  New size: 2; reason: pods metric rate_5m_http_server_requests_seconds_count above target
Normal  SuccessfulRescale  23m (x4 over 128m)   horizontal-pod-autoscaler  New size: 3; reason: pods metric rate_5m_http_server_requests_seconds_count above target

Is it possible to tell Kubernetes not to scale for the first N seconds/minutes or is there another way around this problem?

-- James Hargreaves
autoscaling
kubernetes
kubernetes-hpa

1 Answer

11/12/2019

As mentioned by @James in the comments it is a bug that is being tracked here and here.

I am posting this as a community wiki for better visibility.

-- OhHiMark
Source: StackOverflow