GKE Clusters

How to Optimize Google Managed Kubernetes Clusters

1. Download Kaytu CLI


brew tap kaytu-io/cli-tap && brew install kaytu


curl -fsSL https://raw.githubusercontent.com/kaytu-io/kaytu/main/scripts/install.sh | sh

Windows (and all Binaries) Download Windows (Linux, and MacOS) binary from releases

2. Login to kaytu CLI

kaytu login

Install the Kaytu CLI plugin

kaytu plugin install kubernetes

3. Login to Google Cloud CLI

If you don't have Google Cloud CLI, go here and install it and run this command:

gcloud components install kubectl

Run to confirm you are logged in to the correct account

gcloud auth list

4. Authenticate to Kubernetes Cluster

gcloud container clusters get-credentials [cluster-1] --zone [us-central1-c] --project  [mumbai-341413]

Replace the parameters enclosed in [] with your cluster name, zone, and project-id.


kubectl get pods

to confirm you are connected to the cluster

5. Install Kubernetes Agent

5a. Generate Enrollment Keys

Enrollment keys allow the Kubernetes cluster to get optimization results from the Kaytu platform.

kaytu apikey generate [cluster-name]

Replace the Cluster name with the Kubernetes Cluster.

Please copy the enrollment key provided. Unfortunately, you won't be able to view the key at a later time.

5b. Add Helm Repo

helm repo add kaytu-io https://kaytu-io.github.io/kaytu-charts

Once that completes, let's fetch the latest list of charts

helm repo update

5c. Populate the values.yaml

In values.yaml file, please make sure the following variables are correctly configured:

kaytu.kaytu.authToken needs to be populated with the key generated in Step 4.

kaytu.kaytu.prometheus.address needs to be pointed to the Prometheus endpoint.

5d. Install the Chart

This will create a namespace if one doesn't exist for Kaytu

helm install --create-namespace -n kaytu-system my-kaytu-agent kaytu-io/kaytu-agent -f values.yaml

5e. Wait for optimization

Check the logs and wait for the optimization cycle to be over

kubectl logs -f kaytu-agent-0

Wait for the log containing the optimization cycle to be completed.

6. Run optimization Checks

kaytu optimize kubernetes

Last updated