Aller au contenu

VPA User's Guide#

VPA Resource Deployment#

A VPA resource has to be deployed for each Deployment, StatefulSet and DaemonSet. Below is a generic template which can be adapted:

apiVersion: autoscaling.k8s.io/v1beta2
kind: VerticalPodAutoscaler
metadata:
  name: <name_of_vpa_resource>
  namespace: <namespace>
spec:
  targetRef:
    apiVersion: "apps/v1"
    kind:       <Deployment|Statefulset|Daemonset>
    name:      <name_of_target_deployment>
  updatePolicy:
    updateMode: "Auto"
#### Optional section
  resourcePolicy:
    containerPolicies:
      - containerName: "*"
        minAllowed:
          cpu: 300m
          memory: 5Gi
        maxAllower:
          cpu: 4 
          memory: 20Gi
####
A more detailed documentation is available here: https://docs.openshift.com/container-platform/4.5/nodes/pods/nodes-pods-vertical-autoscaler.html#nodes-pods-vertical-autoscaler-using-about_nodes-pods-vertical-autoscaler

Verify VPA#

Check the recommendations#

  • Get a list of VPA resources
    kubectl -n <namespace> get vpa
    
  • Get detailes about a specific VPA resource
    kubectl -n <namespace> get vpa <vpa_name> -o yaml
    

Check VPA logs#

VPA itself is deployed in the kube-system namespace.

Check evictions#

Using kubectl

kubectl -n kube-system logs vpa-updater-XXXXXX
Using grafana => The vpa_caascad_pod_evictions metric can be used to see when pods have been evicted

Check karma#

Check karma to see if VPA did not cause any problems. Things to look for are memory and cpu warning.