Once all details about your cluster are in place, the generation of the onboarding script will be completed. Copy the script and run it your terminal or cloud shell. Make sure that kubectl is installed and can access your cluster.
The script will create the
castai-agent namespace and deployment. After the installation, your cluster should appear at the bottom of the screen as well as in the Clusters list.
From there, you can open the Available savings report and explore a detailed savings estimate based on your cluster configuration.
The agent will run in read-only mode providing saving suggestions without any actual modifications.
To unlock all the benefits and enable automatic cost optimization, CAST AI must have access to your cluster. The following section describes the steps required to onboard the GKE cluster on the CAST AI console. To make it less troublesome, we created a script that automates most of the steps.
gcloud- A command line tool for working with GKE services using commands in your command-line shell. For more information, see Installing gcloud.
IAM permissions– The IAM user that you're using must have:
- Access to the project where the cluster is created.
- Permissions to work with IAM, GKE, and compute resources.
- The CAST AI agent has to be running on the cluster.
To onboard your cluster, go to the Available Savings report and click on the Start saving or Enable CAST AI button. The button's name will depend on the number of optimizations available in your cluster.
Follow the instruction in the pop-up window to import your GKE service account key (json).
The script will create a new GKE service account with the required roles and print out service account json which then can be added to the CAST AI console and assigned to the corresponding GKE cluster.
The generated user will have the following permissions:
/roles/cast.gkeAccess(created by script) - access to get / update your GKE cluster and manage compute instances.
roles/container.developer- access to resources within the Kubernetes cluster.
That’s it! Your cluster is onboarded. You can now enable policies to keep your cluster configuration optimal.
Disconnect GKE cluster¶
In order to disconnect your cluster from CAST AI click Disconnect cluster button in Clusters list and follow the guidance. Alternatively, run the following command from your terminal used to access the cluster:
kubectl delete deployment castai-agent -n castai-agent
Once the cluster is disconnected, its
Status will change to
Disconnected and you can choose to remove it from the console by pressing the Delete cluster button.
The cluster will continue to run as normal, since the Delete cluster action only removes it from CAST AI console.