A component that connects your Kubernetes cluster to the CAST AI platform to enable Kubernetes automation and cost optimization features.
Visit the docs to connect your cluster.
The helm chart for the CAST AI Kubernetes agent is published in the castai/helm-charts repo.
You can pass configuration to agent via YAML file.
Example file
api:
key: "api key"
url: "api.cast.ai"
or
api.key: "api key"
api.url: "api.cast.ai"
Shell example
CONFIG_PATH=<PATH_TO_CONFIG> ./castai-agent
You must provide the these environment variables:
API_KEY=your-castai-api-key
API_URL=api.cast.ai
KUBECONFIG=/path/to/kubeconfig
Then, based on the Kubernetes provider, you need to provide additional environment variables.
PROVIDER=aks
AKS_LOCATION=your-cluster-location
AKS_SUBSCRIPTION_ID=your-cluster-subscription-id
AKS_NODE_RESOURCE_GROUP=your-cluster-resource-group
PROVIDER=eks
EKS_ACCOUNT_ID=your-aws-account-id
EKS_REGION=your-cluster-region
EKS_CLUSTER_NAME=your-cluster-name
PROVIDER=kops
PROVIDER=gke
GKE_PROJECT_ID=your-gke-project-id
GKE_CLUSTER_NAME=your-cluster-name
GKE_REGION=your-cluster-region
GKE_LOCATION=your-cluster-location
note, when using zonal GKE_REGION
and GKE_LOCATION
is often the same, i.e. europe-west3-a
If you want to test changes with existing cluster already onboarded to CAST AI console, you can set environment variable
STATIC_CLUSTER_ID=your-cluster-id
If you encounter "Error: no Auth Provider found for name "gcp"", add a discard import to the main fn:
import (
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
)
- Prepare a repository to work with your cluster, e.g. Google Artifact Repository if working with a GKE cluster
- Create and push agent image with
TAG=path/to/repository/k8s-agent:1.1-your-test-tag make build
. This will build the multi-architecture agent docker image and push it to the repository of your choice.TAG
in this case should refer to the full image path and will be used fordocker push
command as-is. Increment the version when building more test versions. - Clone castai/helm-charts repo;
- Add necessary changes to the chart (if needed)
- Clone values.yaml and tweak these chart values:
image.repository
: for image build above, set this topath/to/repository/k8s-agent
image.tag
: for above example, this would be1.1-your-test-tag
clusterVPA.enabled
: turn off for testing setupsapiURL
: override if using non-production CAST AI environment (CAST AI developers only)apiKey
: API key to use for the agent
- Deploy the chart:
helm template castai-agent . -n castai-agent -f values.ignore.yaml | kubectl apply -f -
Head to the GitHub new release page, create a new tag at the top, and click Generate Release Notes
at the middle-right.