| name | castai-local-dev-loop |
| description | Set up a local Kubernetes development loop with CAST AI cost monitoring.
Use when building cost-aware deployments, testing autoscaler policies,
or iterating on Terraform CAST AI configurations locally.
Trigger with phrases like "cast ai dev setup", "cast ai local testing",
"develop with cast ai", "cast ai terraform dev".
|
| allowed-tools | Read, Write, Edit, Bash(kubectl:*), Bash(helm:*), Bash(terraform:*), Grep |
| version | 1.4.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","kubernetes","cost-optimization","castai"] |
| compatibility | Designed for Claude Code |
CAST AI Local Dev Loop
Overview
Fast iteration workflow for CAST AI integrations: test autoscaler policies in a dev cluster, validate Terraform modules before applying to production, and use the CAST AI API to measure savings impact during development.
Prerequisites
- Completed
castai-install-auth setup
- A development Kubernetes cluster (kind, minikube, or cloud dev cluster)
kubectl, helm, and optionally terraform installed
Instructions
Step 1: Project Structure
my-castai-infra/
โโโ terraform/
โ โโโ environments/
โ โ โโโ dev.tfvars
โ โ โโโ staging.tfvars
โ โ โโโ prod.tfvars
โ โโโ modules/
โ โ โโโ castai-cluster/
โ โ โโโ main.tf
โ โ โโโ variables.tf
โ โ โโโ outputs.tf
โ โโโ main.tf
โโโ policies/
โ โโโ dev-policy.json
โ โโโ prod-policy.json
โโโ scripts/
โ โโโ check-savings.sh
โ โโโ validate-policies.sh
โโโ .env.dev # Dev API key (git-ignored)
โโโ .env.example
Step 2: Dev Cluster with Relaxed Policies
helm upgrade --install castai-agent castai-helm/castai-agent \
-n castai-agent --create-namespace \
--set apiKey="${CASTAI_API_KEY_DEV}" \
--set provider="eks"
curl -X PUT -H "X-API-Key: ${CASTAI_API_KEY_DEV}" \
-H "Content-Type: application/json" \
"https://api.cast.ai/v1/kubernetes/clusters/${CASTAI_CLUSTER_ID}/policies" \
-d '{
"enabled": true,
"unschedulablePods": { "enabled": true },
"nodeDownscaler": {
"enabled": true,
"emptyNodes": { "enabled": true, "delaySeconds": 300 }
},
"clusterLimits": {
"enabled": true,
"cpu": { "minCores": 2, "maxCores": 16 }
}
}'
Step 3: Quick Savings Check Script
#!/bin/bash
set -euo pipefail
API_KEY="${CASTAI_API_KEY_DEV}"
CLUSTER_ID=
curl -s -H \
\
| jq