# Frequently Asked Questions

We get a lot of questions about how Goldilocks works and where it gets the recomendations. Hopefully we can answer the most common ones here.

# How does Goldilocks generate recommendations?

Goldilocks doesn't do any recommending of resource requests/limits by itself. It utilizes a Kubernetes project called Vertical Pod Autoscaler (VPA) (opens new window). More specifically, it uses the Recommender (opens new window) portion of the VPA.

According to the VPA documentation:

After starting the binary, recommender reads the history of running pods and their usage from Prometheus into the model. It then runs in a loop and at each step performs the following actions:

update model with recent information on resources (using listers based on watch),
update model with fresh usage samples from Metrics API,
compute new recommendation for each VPA,
put any changed recommendations into the VPA resources.

This means that recommendations are generated based on historical usage of the pod over time.

# Which values from the VPA are used?

There are two types of recommendations that Goldilocks shows in the dashboard. They are based on Kubernetes QoS Classes (opens new window)

A VPA recommendation section looks like this:

    - containerName: basic-demo
        cpu: 10m
        memory: "26214400"
        cpu: 11m
        memory: "26214400"
        cpu: 11m
        memory: "26214400"
        cpu: 12m
        memory: "26214400"

We generate two different QoS classes of recommendation from this

  • For Guaranteed, we take the target field from the recommendation and set that as both the request and limit for that container
  • For Burstable, we set the request as the lowerBound and the limit as the upperBound from the VPA object

# How Accurate is Goldilocks?

This is entirely based on the underlying VPA project. However, in our experience Goldilocks has usually been a good starting point for setting your resource requests and limits. Every environment will be different, and Goldilocks is not a replacement for tuning your applications for your specific use-case.

# I don't see any VPA objects getting created, what gives?

There's two main possibilities here:

  • You have not labelled any namespaces for use by goldilocks. Try kubectl label ns <namespace-name> goldilocks.fairwinds.com/enabled=true
  • VPA is not installed. The goldilocks logs will indicate if this is the case.

# I am not getting any recommendations, what gives?

The first thing to do is wait a few minutes. The VPA recommender takes some time to populate data.

The next most common cause of this is that metrics server is not running, or the metrics api-service isn't working, so VPA cannot provide any recommendations. There are a couple of things you can check.

# Check that the metrics apiservice is available:

This indicates an issue:

▶ kubectl get apiservice v1beta1.metrics.k8s.io
NAME                     SERVICE                         AVAILABLE                  AGE
v1beta1.metrics.k8s.io   metrics-server/metrics-server   False (MissingEndpoints)   7s

This shows a healthy metrics service:

▶ kubectl get apiservice v1beta1.metrics.k8s.io
NAME                     SERVICE                         AVAILABLE   AGE
v1beta1.metrics.k8s.io   metrics-server/metrics-server   True        36s