VPA in Kubernetes with Goldilocks
Before we dig into Goldilocks tool, we need to first understand what is VPA (Vertical Pod Autoscaler)?
VPA (Vertical Pod Autoscaler)
Vertical Pod Autoscaler (VPA) frees the users from necessity of setting up-to-date resource limits and requests for the containers in their pods. When configured, it will set the requests automatically based on usage and thus allow proper scheduling onto nodes so that appropriate resource amount is available for each pod. It will also maintain ratios between limits and requests that were specified in initial containers configuration.
VPA can work in 4 modes. To get more information about VPA, can get it from here.
Auto
Recreate
Initial
Off
So now as we know about VPA in Kubernetes, let’s understand about Goldilocks tools & how we can utilize it and also a quick look on the installation.
Goldilocks
Goldilocks is a utility that can help you identify a starting point for resource requests and limits and also helps to beautify the recommendations through UI. It has below pre-requisites.
- kubectl
- vertical-pod-autoscaler (opens new window) configured in the cluster
- metrics-server (a requirement of vpa)
- golang 1.11+
To utilize this tool, we need to run VPA in Off
mode which means recommendation mode. If VPA doesn’t exists already, this tool can also create it for each deployment in a namespace and then queries it for information.
If VPA already exists in a namespace? You just need to label the existing VPA with below labels.
label:
creator: Fairwinds
source: goldilocks
Installation
There are 2 methods available to install.
- Kubectl
- Helm
We will cover the helm way, which is easier and recommended. Following are the commands to install.
helm repo add fairwinds-stable https://charts.fairwinds.com/stableHelm v2:
helm install --name goldilocks fairwinds-stable/goldilocksHelm v3:
helm install goldilocks fairwinds-stable/goldilocks
Finally to be able to let this tool see all the namespaces, you need to label namespaces as well with below label.
labels:
goldilocks.fairwinds.com/enabled: "true"
All done! Now you can use the port-forward to see the dashboard on http://localhost:8080
kubectl port-forward svc/goldilocks-dashboard 8080:80