HPA scales up despite utilization being under target #129228
Labels
kind/bug
Categorizes issue or PR as related to a bug.
needs-triage
Indicates an issue or PR lacks a `triage/foo` label and requires one.
sig/autoscaling
Categorizes an issue or PR as relevant to SIG Autoscaling.
What happened?
We use Argo Rollouts to perform canary deployments of our services. During a canary deployment, new pods are brought up (the canary pods) which are included in the Status of the Rollout's scale subresource. When HPA is configured to scale on a metric with a high utilization ratio (generally memory), this results in HPA scaling out, despite the fact that the utilization is under the target.
This seems to be a result of the behaviour of the replica calculator where:
In addition, the utilization ratio is never checked prior to updating prior to HPA increasing the desired replicas leading to incorrect/misleading log messages like "New size: X; reason: memory resource utilization (percentage of request) above target".
Further details can be found in issues logged for Argo Rollouts here and here.
What did you expect to happen?
HPA should not scale up when utilization is below target (I.e. when
utilizationRatio < 1
)How can we reproduce it (as minimally and precisely as possible)?
The issue can be reproduced by simulating the behaviour of Argo Rollouts and creating a 2nd
ReplicaSet
with selectors that match an existingDeployment
. For example:Create base
Deployment
andHorizontalPodAutoscaler
resources:Wait to ensure that metrics are available and HPA is stable at 3 pods.
Create a 2nd replica set:
Observe that HPA will scale the existing
Deployment
:Check events on HPA to see details on why scaling occurred:
Anything else we need to know?
No response
Kubernetes version
Cloud provider
OS version
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, ...) and versions (if applicable)
The text was updated successfully, but these errors were encountered: