Skip to content

HPA-VPA incompatibility with non-external metrics

When configuring Kubernetes autoscaling, combining the Horizontal Pod Autoscaler (HPA) with the Vertical Pod Autoscaler (VPA) requires careful consideration of the metrics used. A specific incompatibility arises when HPA relies on metrics other than external metrics while VPA operates in its automatic adjustment mode.

The Conflict

The incompatibility manifests specifically when HPA utilizes non-external metrics (such as standard resource metrics like CPU or memory, or custom metrics) simultaneously with VPA operating in Auto mode.^[400-devops__06-Kubernetes__k8s-ithelp__Day27__README.md]

In this configuration, the two autoscalers can interfere with each other's logic, leading to "unpredictable problems."^[400-devops__06-Kubernetes__k8s-ithelp__Day27__README.md]

This instability occurs because both controllers attempt to manage the application's resource consumption simultaneously but with conflicting mechanisms: VPA alters the resource requests (which affects the utilization percentage HPA targets), while HPA scales the number of replicas based on those utilization metrics.

To avoid these conflicts while still leveraging the insights provided by VPA, a recommended approach is to use HPA for scaling but configure VPA in Off mode rather than Auto.^[400-devops__06-Kubernetes__k8s-ithelp__Day27__README.md]

In Off mode, the VPA will generate resource recommendations based on historical monitoring data, but it will not automatically evict pods or enforce these changes.^[400-devops__06-Kubernetes__k8s-ithelp__Day27__README.md] Administrators can then manually apply these recommendations to optimize resource configuration without triggering the instability associated with the automatic loop.

Sources

^[400-devops__06-Kubernetes__k8s-ithelp__Day27__README.md]