Goldilocks Documentation
repository·master·Indexed 25 days ago
https://github.com/fairwindsops/goldilocksGoldilocks 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.
What's inside Goldilocks
- Goldilocks is a utility designed to help Kubernetes users identify optimal starting points for resource requests and limits. It works by leveraging the Kubernetes Vertical Pod Autoscaler (VPA) in recommendation mode. Goldilocks automatically creates a VPA for each workload within a namespace and queries them to provide resource suggestions.
Requirements for Goldilocks
masterBefore 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, orStatefulSets). - 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.
Understand how Goldilocks generates recommendations
masterGoldilocks 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.Install the Goldilocks CLI
masterTo 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/Enable Goldilocks in a Namespace
masterGoldilocks 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=trueOnce 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 modeonly.Enable VPA on GKE Standard Clusters
masterIn GKE Autopilot clusters, VPA is enabled by default. For GKE Standard clusters, you must enable it manually using the
gcloudCLI. 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]}Install Goldilocks via Helm (Preferred)
masterTo install Goldilocks using Helm, first add the Fairwinds stable repository and create the
goldilocksnamespace. Use the following commands based on your Helm version:Helm v3:
helm install goldilocks --namespace goldilocks fairwinds-stable/goldilocksHelm v2:
helm install --name goldilocks --namespace goldilocks fairwinds-stable/goldilockshelm repo add fairwinds-stable https://charts.fairwinds.com/stable kubectl create namespace goldilocks # For Helm v3: helm install goldilocks --namespace goldilocks fairwinds-stable/goldilocksEnable Goldilocks management for a Namespace
masterTo allow the Goldilocks controller to manage a namespace and create VPAs, apply thegoldilocks.fairwinds.com/enabled=truelabel to that namespace.Exclude containers from recommendations
masterTo hide recommendations for specific containers (like sidecars such as
istio-proxyorlinkerd-proxy), you can use two methods:- CLI Flag: Use
--exclude-containerswith thedashboardorsummarycommands. - Workload Label: Apply the
goldilocks.fairwinds.com/exclude-containerslabel to a workload controller (Deployment, StatefulSet, etc.) with a comma-separated list of container names.
- CLI Flag: Use
Access the Goldilocks Dashboard
masterThe dashboard is installed as a ClusterIP service by default. To access the UI locally, use
kubectl port-forwardto map port 8080 on your machine to port 80 on the dashboard service.After running the command, navigate to http://localhost:8080 in your browser.
kubectl -n goldilocks port-forward svc/goldilocks-dashboard 8080:80Use immutable and signed Goldilocks images
masterGoldilocks images are now signed and use immutable tags. Floating tags such asv4,v4.14, orlatestare no longer supported. To ensure stability and security, you must use a full version tag or pin the image by its SHA256 digest.Migrate to the new Goldilocks container registry
masterAs of version v4.15.0, the container registry has moved. The old registry
quay.io/fairwinds/goldilocksis 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>