Kubernetes HPA-VPA incompatibility¶
The Kubernetes HPA-VPA incompatibility refers to the conflict that arises when attempting to use Horizontal Pod Autoscaler (HPA) and Vertical Pod Autoscaler (VPA) simultaneously on the same workload.^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md]
Mechanism of Conflict¶
This incompatibility stems from the interaction between the VPA's Updater component and the HPA's scaling logic. When the VPA determines that a Pod's resource configuration needs to change, it must delete the existing Pod and recreate it with the updated requests and limits.^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md]
Concurrently, the HPA calculates the desired number of replicas based on the ratio of current resource usage to the desired target value. If the VPA alters the resource requests—increasing them, for instance—the HPA's metric calculation (which relies on these values to determine usage percentage) may become unstable or incorrect, leading to a "control loop" fight.^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md]
Exceptions and Alternatives¶
While generally incompatible, there are specific scenarios and solutions where they can be used together or bypass the limitation:
- Custom Metrics: The incompatibility can be avoided if the HPA is configured to use a custom metric as the trigger for autoscaling, rather than CPU or memory Metrics that the VPA modifies.^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md]
- Multidim Pod Autoscaler (MPA): To achieve simultaneous horizontal and vertical scaling on standard Metrics, the Multidim Pod Autoscaler (MPA) is required.^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md] Currently, this functionality is primarily available on the GCP GKE platform (in beta), where it allows for autoscaling that utilizes HPA for CPU and VPA for memory concurrently.^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md]
Related Concepts¶
Sources¶
- 400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md