Goldilocks Documentation

repository·master·Indexed 25 days ago

https://github.com/fairwindsops/goldilocks

Goldilocks is a Kubernetes utility that provides resource request and limit recommendations by analyzing Vertical Pod Autoscaler (VPA) data in recommendation mode. It includes a controller for automatic VPA management via namespace labels, a CLI for manual VPA creation, deletion, and JSON summaries, and a web dashboard for visualizing resource suggestions.

Tokens
4.5K
Snippets
12
Records
45
Agent score
85%

What's inside Goldilocks

  1. Requirements for Goldilocks

    master

    Before installing Goldilocks, ensure your cluster meets the following requirements:

    • kubectl: Installed and configured.
    • Vertical Pod Autoscaler (VPA): Must be configured in the cluster.
    • metrics-server: Required by VPA.
    • Workloads: You must have workloads with PodSpec templates (e.g., Deployments, DaemonSets, or StatefulSets).
    • golang 1.17+: (If building from source).

    VPA Installation Notes

    • Goldilocks only requires the VPA recommender.
    • If you use the Goldilocks Helm chart with the VPA sub-chart, only the VPA recommender will be installed, avoiding the potential side effects of the VPA admission webhook.
    • Prometheus: Supported and can provide more accurate results, though not strictly required.
  2. Understand how Goldilocks generates recommendations

    master
    Goldilocks does not generate recommendations itself. Instead, it utilizes the Vertical Pod Autoscaler (VPA) Recommender. The VPA Recommender reads historical pod usage from Prometheus and fresh usage samples from the Kubernetes Metrics API to compute recommendations. These recommendations are based on the historical usage of the pod over time.
  3. Install the Goldilocks CLI

    master

    To install the Goldilocks CLI on Linux, download the appropriate release from the GitHub releases page, extract the archive, and move the binary to your PATH.

    Example for Linux amd64:

    curl -L "https://github.com/FairwindsOps/goldilocks/releases/download/v4.0.0/goldilocks_4.0.0_linux_amd64.tar.gz" > goldilocks.tar.gz
    tar -xvf goldilocks.tar.gz
    sudo mv goldilocks /usr/local/bin/
  4. Enable Goldilocks in a Namespace

    master

    Goldilocks uses Kubernetes namespace labels to determine which namespaces should have Vertical Pod Autoscaler (VPA) objects created for their deployments. To enable Goldilocks for a specific namespace, apply the following label to that namespace:

    goldilocks.fairwinds.com/enabled=true

    Once this label is present, the Goldilocks controller will reconcile the namespace and ensure a VPA object is created for every deployment within it. Note that all VPAs created by Goldilocks are set to recommendation mode only.

  5. Enable VPA on GKE Standard Clusters

    master

    In GKE Autopilot clusters, VPA is enabled by default. For GKE Standard clusters, you must enable it manually using the gcloud CLI. Note that enabling VPA via GKE does not support using Prometheus as a data backend.

    gcloud container clusters update [CLUSTER-NAME] --enable-vertical-pod-autoscaling {--region [REGION-NAME] | --zone [ZONE-NAME]}
  6. Install Goldilocks via Helm (Preferred)

    master

    To install Goldilocks using Helm, first add the Fairwinds stable repository and create the goldilocks namespace. Use the following commands based on your Helm version:

    Helm v3:

    helm install goldilocks --namespace goldilocks fairwinds-stable/goldilocks

    Helm v2:

    helm install --name goldilocks --namespace goldilocks fairwinds-stable/goldilocks
    helm repo add fairwinds-stable https://charts.fairwinds.com/stable
    kubectl create namespace goldilocks
    # For Helm v3:
    helm install goldilocks --namespace goldilocks fairwinds-stable/goldilocks
  7. Exclude containers from recommendations

    master

    To hide recommendations for specific containers (like sidecars such as istio-proxy or linkerd-proxy), you can use two methods:

    1. CLI Flag: Use --exclude-containers with the dashboard or summary commands.
    2. Workload Label: Apply the goldilocks.fairwinds.com/exclude-containers label to a workload controller (Deployment, StatefulSet, etc.) with a comma-separated list of container names.
  8. Use immutable and signed Goldilocks images

    master
    Goldilocks images are now signed and use immutable tags. Floating tags such as v4, v4.14, or latest are no longer supported. To ensure stability and security, you must use a full version tag or pin the image by its SHA256 digest.
  9. Migrate to the new Goldilocks container registry

    master

    As of version v4.15.0, the container registry has moved. The old registry quay.io/fairwinds/goldilocks is deprecated. You must update your deployment manifests to use the new Google Artifact Registry location.

    - quay.io/fairwinds/goldilocks:<tag>
    + us-docker.pkg.dev/fairwinds-ops/oss/goldilocks:<tag>