Skip to content

Latest commit

 

History

History
137 lines (101 loc) · 3.92 KB

File metadata and controls

137 lines (101 loc) · 3.92 KB

CAST AI Anywhere Terraform Deployment

This repository contains Terraform code to deploy CAST AI components on an "anywhere" (on-prem/Minikube) Kubernetes cluster. The configuration deploys two components:

  • CAST AI Agent
  • CAST AI Cluster Controller
  • **CAST AI Evictor
  • **CAST AI Pod Mutator
  • **CAST AI Workload Autoscaler

Prerequisites

Before deploying, ensure you have the following installed and configured:

You will also need:

Repository Structure

  • main.tf
    Contains the Terraform configuration to:
    • Start Minikube and wait until it is ready.
    • Configure the Kubernetes and Helm providers (using the minikube context).
    • Create the required namespace.
    • Deploy the CAST AI Components.
  • variables.tf
    Defines variables for CAST AI API key, cluster identifier, and configurations.
  • outputs.tf
    Displays outputs such as the status of the deployed components.

Setup and Deployment

1. Clone the Repository

Clone the repository to your local machine:

git clone https://github.com/juliette-cast/castai-anywhere-terraform.git
cd castai-anywhere-terraform

2. Initialize Terraform

Run the following command to initialize Terraform and download the required providers:

terraform init

3. Validate the Terraform Configuration

Ensure the configuration is correct:

terraform validate

4. Plan the Deployment

Preview what Terraform will create:

terraform plan

5. 1st Apply the Configuration

This will create the cluster and Deploy the CAST AI Agentand connect to the UI, then you will use the clustr ID from the console to add to your vaoraibles to deploy the other components

terraform apply

6. 2nd Apply to deploy the other components

terraform apply

7. Verify Deployment

Check the status of deployed components:

kubectl get pods -n castai-agent

Expected output:

NAME                                          READY   STATUS    RESTARTS   AGE
castai-agent-79bf777cc8-8w88l                 2/2     Running   0             22m
castai-agent-79bf777cc8-kvf2q                 2/2     Running   0             22m
castai-agent-cpvpa-964fc94b6-pqfzc            1/1     Running   0             23m
castai-cluster-controller-77dffcd8f5-7jflv    2/2     Running   0             19m
castai-cluster-controller-77dffcd8f5-cpnp6    2/2     Running   0             19m
castai-evictor-64bdd9fb6c-tmxjv               1/1     Running   0             37s
castai-evictor-cpvpa-6c6bdf8f74-r2m4b         1/1     Running   0             37s
castai-pod-mutator-7556c5db85-pqrwx           1/1     Running   0             16m
castai-pod-mutator-7556c5db85-tqzsh           1/1     Running   1             16m
castai-workload-autoscaler-64655596c4-b72l7   1/1     Running   0             15m
castai-workload-autoscaler-64655596c4-x7bj8   1/1     Running   1 (15m ago)   15m

7. Check CAST AI Console

  1. Log in to CAST AI Console
  2. Navigate to Clusters
  3. Confirm that the Minikube cluster is "Connected"

8. Optional: Destroy the Deployment

If you need to remove the deployment, run:

terraform destroy

or delete the castai-agent namespace

kubectl delete ns castai-agent

If you need to delete the minikube cluster, run the below command then check on Docker if it's deleted:

minikube delete