### Install Goldilocks using Manifests Source: https://goldilocks.docs.fairwinds.com/installation Installs Goldilocks by applying Kubernetes YAML manifests from its GitHub repository. This method involves cloning the repository, creating a namespace, and applying the controller and dashboard manifests. ```bash git clone https://github.com/FairwindsOps/goldilocks.git cd goldilocks kubectl create namespace goldilocks kubectl -n goldilocks apply -f hack/manifests/controller kubectl -n goldilocks apply -f hack/manifests/dashboard ``` -------------------------------- ### Install Goldilocks using Helm Source: https://goldilocks.docs.fairwinds.com/installation Installs the Goldilocks application using the Fairwinds Helm chart. This is the preferred method and requires adding the Fairwinds stable repository and creating a namespace. ```bash helm repo add fairwinds-stable https://charts.fairwinds.com/stable kubectl create namespace goldilocks helm install goldilocks --namespace goldilocks fairwinds-stable/goldilocks ``` -------------------------------- ### Install Goldilocks CLI Source: https://goldilocks.docs.fairwinds.com/advanced Installs the Goldilocks CLI tool on Linux by downloading a tarball from the releases page, extracting it, and moving the binary to the system's PATH. ```bash 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 Namespace Labeling Source: https://goldilocks.docs.fairwinds.com/installation Labels a Kubernetes namespace to enable Goldilocks to monitor workloads within it. After applying this label, VPA objects should start appearing in the specified namespace. ```bash kubectl label ns goldilocks goldilocks.fairwinds.com/enabled=true ``` -------------------------------- ### Run Goldilocks Dashboard Server Source: https://goldilocks.docs.fairwinds.com/advanced The `dashboard` command starts the Goldilocks dashboard server, which displays VPA recommendations. By default, it listens on port 8080. ```bash goldilocks dashboard ``` -------------------------------- ### Enable Vertical Pod Autoscaling on GKE Standard Clusters Source: https://goldilocks.docs.fairwinds.com/installation Command to enable VPA on Google Kubernetes Engine (GKE) standard clusters. This is a prerequisite for Goldilocks if using GKE. Note that this command does not support using Prometheus as a data backend. ```bash gcloud container clusters update [CLUSTER-NAME] --enable-vertical-pod-autoscaling {--region [REGION-NAME] | --zone [ZONE-NAME]} ``` -------------------------------- ### Access Goldilocks Dashboard via Port Forward Source: https://goldilocks.docs.fairwinds.com/installation Accesses the Goldilocks dashboard by setting up a port forward from your local machine to the dashboard's ClusterIP service. Once the port forward is active, you can access the dashboard through your web browser. ```bash kubectl -n goldilocks port-forward svc/goldilocks-dashboard 8080:80 ``` -------------------------------- ### Checking Metrics API Service Availability (Issue) Source: https://goldilocks.docs.fairwinds.com/faq Shows the output of `kubectl get apiservice v1beta1.metrics.k8s.io` when the metrics server is not available or not functioning correctly. The 'AVAILABLE' column shows 'False (MissingEndpoints)', indicating a problem. ```bash ▶ kubectl get apiservice v1beta1.metrics.k8s.io NAME SERVICE AVAILABLE AGE v1beta1.metrics.k8s.io metrics-server/metrics-server False (MissingEndpoints) 7s ``` -------------------------------- ### Checking Metrics API Service Availability (Healthy) Source: https://goldilocks.docs.fairwinds.com/faq Shows the output of `kubectl get apiservice v1beta1.metrics.k8s.io` when the metrics server is healthy and available. The 'AVAILABLE' column shows 'True', indicating that metrics are being served correctly. ```bash ▶ kubectl get apiservice v1beta1.metrics.k8s.io NAME SERVICE AVAILABLE AGE v1beta1.metrics.k8s.io metrics-server/metrics-server True 36s ``` -------------------------------- ### Goldilocks CLI Help and Commands Source: https://goldilocks.docs.fairwinds.com/advanced Displays the help information and available commands for the Goldilocks CLI tool. This provides an overview of its functionalities, including creating VPAs, running a dashboard, and generating summaries. ```bash A tool for analysis of kubernetes workload resource usage. Usage: goldilocks [flags] goldilocks [command] Available Commands: completion generate the autocompletion script for the specified shell controller Run goldilocks as a controller inside a kubernetes cluster. create-vpas Create VPAs dashboard Run the goldilocks dashboard that will show recommendations. delete-vpas Delete VPAs help Help about any command summary Generate a summary of vpa recommendations. version Prints the current version of the tool. Flags: -h, --help help for goldilocks --kubeconfig string Kubeconfig location. [KUBECONFIG] (default "$HOME/.kube/config") -v, --v Level number for the log level verbosity Use "goldilocks [command] --help" for more information about a command. ``` -------------------------------- ### VPA Recommendation Structure Source: https://goldilocks.docs.fairwinds.com/faq Illustrates the structure of a VPA recommendation object, showing container-specific recommendations including lower bound, target, uncapped target, and upper bound for CPU and memory. ```yaml recommendation: containerRecommendations: - containerName: basic-demo lowerBound: cpu: 10m memory: "26214400" target: cpu: 11m memory: "26214400" uncappedTarget: cpu: 11m memory: "26214400" upperBound: cpu: 12m memory: "26214400" ``` -------------------------------- ### Create VPAs using Goldilocks CLI Source: https://goldilocks.docs.fairwinds.com/advanced The `create-vpas` command searches for workloads in a specified namespace and generates a VPA for each. Each generated VPA is labeled for use by the Goldilocks tool. ```bash goldilocks create-vpas -n some-namespace ``` -------------------------------- ### Labeling Namespace for Goldilocks Source: https://goldilocks.docs.fairwinds.com/faq Demonstrates the kubectl command to label a namespace, enabling Goldilocks to process resources within that namespace. This is a common troubleshooting step if VPA objects are not being created. ```bash kubectl label ns goldilocks.fairwinds.com/enabled=true ``` -------------------------------- ### VPA Recommender Actions Source: https://goldilocks.docs.fairwinds.com/faq Describes the steps performed by the Vertical Pod Autoscaler (VPA) recommender when generating resource recommendations. It reads historical pod usage from Prometheus, updates its model with recent information, computes new recommendations, and updates VPA resources. ```text 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. ``` -------------------------------- ### Summarize VPA Objects using Goldilocks CLI Source: https://goldilocks.docs.fairwinds.com/advanced The `summary` command queries all VPA objects labeled for Goldilocks across all namespaces and consolidates their suggestions into a JSON object. ```bash goldilocks summary ``` -------------------------------- ### Set VPA Update Mode for a Namespace Source: https://goldilocks.docs.fairwinds.com/advanced Configures the VPA update mode for a Kubernetes namespace. By default, VPAs are in 'Off' mode, only providing recommendations. Setting the label to 'auto' enables automatic scaling. ```bash kubectl label ns goldilocks goldilocks.fairwinds.com/vpa-update-mode="auto" ``` -------------------------------- ### Apply VPA Resource Policy via Namespace Annotation Source: https://goldilocks.docs.fairwinds.com/advanced Applies a VPA resource policy to a Kubernetes namespace using an annotation. This allows for centralized configuration of resource policies for all workloads within the namespace, overriding individual VPA manifest settings. ```yaml annotations: goldilocks.fairwinds.com/vpa-resource-policy: > { "containerPolicies": [ { "containerName": "nginx", "minAllowed": { "cpu": "250m", "memory": "100Mi" }, "maxAllowed": { "cpu": "2000m", "memory": "2048Mi" } }, { "containerName": "istio-proxy", "mode": "Off" } ] } ``` -------------------------------- ### Define VPA Resource Policy in Kubernetes Manifest Source: https://goldilocks.docs.fairwinds.com/advanced Defines a detailed resource policy for a VerticalPodAutoscaler (VPA) in a Kubernetes manifest. This allows fine-grained control over minimum and maximum resource limits (CPU and memory) and the update mode for specific containers within a workload. ```yaml apiVersion: autoscaling.k8s.io/v1 kind: VerticalPodAutoscaler metadata: name: nginx-vpa spec: targetRef: apiVersion: "apps/v1" kind: Deployment name: nginx updatePolicy: updateMode: "On" resourcePolicy: containerPolicies: - containerName: "nginx" minAllowed: cpu: "250m" memory: "100Mi" maxAllowed: cpu: "2000m" memory: "2048Mi" - containerName: "istio-proxy" mode: "Off" ``` -------------------------------- ### Exclude Containers from Goldilocks Recommendations Source: https://goldilocks.docs.fairwinds.com/advanced The `--exclude-containers` argument can be used with `dashboard` and `summary` commands to hide recommendations for specified comma-separated container names. This is useful for excluding sidecar containers. Additionally, containers can be excluded for individual workloads by applying a label to workload controller resources. ```bash kubectl label deployment myapp goldilocks.fairwinds.com/exclude-containers=linkerd-proxy,istio-proxy ``` -------------------------------- ### Delete VPAs using Goldilocks CLI Source: https://goldilocks.docs.fairwinds.com/advanced The `delete-vpas` command removes all VPA objects within a given namespace that have been labeled for use by the Goldilocks tool. ```bash goldilocks delete-vpas ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.