Vertical Pod Autoscaler on APPUiO Cloud
Setting appropriate limit
and request
values in your deployments is not an easy task. To help our customers, we have enabled the use of the VerticalPodAutoscaler
object on all APPUiO Cloud zones. This blog post will show you how to use it.
To use the VerticalPodAutoscaler
object, you need an APPUiO Cloud project with some payload deployed and running. The Vertical Pod Autoscaler project on GitHub contains some sample YAML files that deploy a very simple demo application to your project.
Here is the YAML required to create a VerticalPodAutoscaler
that will analyze the resource consumption of the vpa-example
deployment:
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: vpa-recommender
spec:
targetRef:
apiVersion: "apps/v1"
kind: Deployment
name: vpa-example
updatePolicy:
updateMode: "Off"
The VPA requires a few moments to gather data and provide recommendations from it. After some time, during which your deployment should have been running in order to gather meaningful data, run the following command and you should see an output similar to this in your terminal:
$ oc get vpa vpa-recommender --output yaml
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
annotations: …
# …
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: vpa-example
updatePolicy:
updateMode: Auto
status:
conditions:
- status: "True"
type: RecommendationProvided
recommendation:
containerRecommendations:
- containerName: fortune-container
lowerBound:
cpu: 25m
memory: 262144k
target:
cpu: 203m
memory: 262144k
uncappedTarget:
cpu: 203m
memory: 262144k
upperBound:
cpu: 71383m
memory: "6813174422"
You should analyze with care the values provided by the autoscaler for your deployment. Don’t blindly apply its recommendations; let your application run for a while and study the numbers closely.
Some tips for your analysis, all inside the status.recommendation
part of the response:
- The
.containerRecommendations[*].target
value could be considered indicative forrequest
values. - The
.containerRecommendations[*].upperBound
value could be used as an indication to setlimit
values.
For more hints, the OpenShift dashboard shown on this page of the APPUiO Cloud documentation shows utilization numbers for both CPU and memory limits. Those values function as a suitable supplementary information source and must be taken into consideration.
The APPUiO Cloud documentation has more information about the VerticalPodAutoscaler
object.