Reputation: 242
We are trying out Kubernetes Autoscaling options. We have configured for Horizontal Pod Autoscaling but was wondering if it is possible to implement both horizontal and vertical auto scaling condition for a particular application ? to explain more I want to be able to increase resource of a pod if I don't want to increase the number of pods and if I don't want to increase the pod resources I will be able to increase the number of pods to scale for the same application.
Upvotes: 1
Views: 1569
Reputation: 426
If your HPA is not based on CPU or Memory you can do this with no problem, but this is not recommended to use both VPA and HPA when the HPA is based on CPU or Memory.
Taken from the VPA documentation: "Vertical Pod Autoscaler should not be used with the Horizontal Pod Autoscaler (HPA) on CPU or memory at this moment"
There are some options on how to do so. For example, you can update the HPA relatively to the CPU/Memory change.
For further examples, there is a free tool named gMaestro that supports both rightsizing and HPA, you can try to use it.
Upvotes: 9
Reputation: 2919
Yes, it is definitely possible to set both Horizontal and Vertical Pod Autoscaling options. You will have to just set the resource limits appropriately. Here's an example:
request
for 300m
CPU and limit
for 800m
CPU. This will configure the VPA to allow the pod to have 300m->800m
of CPU.800m
.Now, what will happen is, the pod will scale vertically, for up to 0.8
vCPU cores, and once it reaches that point, the horizontal auto scaler will kick in and spawn a new pod, and the existing pod will be limited to 0.8vCPU.
Here is a good resource on understanding a VPA setup and getting started with one.
Of course if you want your scaling to be driven by a custom metric, other than vCPU or memory, you will need a custom HPA or VPA controller in your cluster.
This is used a lot and is a very common design pattern :)
Upvotes: 1