DEV Community

Prithiviraj R
Prithiviraj R

Posted on

CAST AI Integration with Amazon EKS — Step-by-Step Guide

This document is a step‑by‑step walkthrough of connecting an Amazon EKS cluster to CAST AI, installing the agent, enabling autoscaler features, and verifying the setup. Screenshots are included from a demo run to illustrate each stage.

1) CAST AI Console — Cluster Onboarding

After signing into CAST AI, you are greeted with a 3-step onboarding:

Select provider (EKS in this case).

Select products to enable.

Start optimizing.

Demo cluster and new EKS cluster both visible with details: nodes, CPU, memory, and cost.

2) Installing CAST AI Agent on EKS
Installed CAST AI agent using the provided script from CAST AI console.

Resources created: namespace, service account, roles, configmaps, and deployment.

Verified pods in castai-agent namespace are running.

Command used:

curl -H "Authorization: Token <CAST_AI_TOKEN>" \
  "https://api.cast.ai/v1/agent.yaml?provider=eks" | kubectl apply -f -
Enter fullscreen mode Exit fullscreen mode

3) Selecting Features

Features enabled during setup:
✅ Cost Monitoring (Free, Read-only)
✅ Cluster Optimization (Premium)
✅ Workload Autoscaler (Premium)
✅ Kubernetes & Cloud Security (Free)

Onboarding script generated with ENV vars (API URL, Cluster ID, Region, Role ARN).

4) Installing Autoscaler Components

Installed CAST AI autoscaler add-ons:

castai-spot-handler

castai-evictor

castai-pod-pinner

castai-kvisor (security agent)

IAM role ARN confirmed and sent to CAST AI console.

Screenshot: Workload autoscaler test

Workload autoscaler tests passed successfully.

castai-live component deployed to support active optimization.

5) Verification of Installed Components

castai-agent → Core agent that connects the EKS cluster to CAST AI and sends telemetry.

castai-cluster-controller → Manages cluster scaling decisions, node pools, and automation.

castai-workload-autoscaler → Dynamically scales workloads based on demand and rightsizing policies.

castai-kvisor → Security component that provides vulnerability scanning and compliance insights.

castai-pod-pinner → Ensures critical pods stay on designated nodes during scaling/rebalancing.

castai-spot-handler → Handles Spot instance lifecycle events and safe eviction.

castai-live → Real-time optimization engine that applies scaling and savings actions instantly.

6) Cost Monitoring & Compliance

Cluster connected with 3 nodes (on-demand only).

Cost shows $0.00 initially, updated after workloads.

Compliance scan shows CIS EKS Benchmark 1.5 checks (21% compliance at first scan).

Cost analysis dashboard shows CPU, memory costs, and allocation details.

Example: Total CPU cost ~$0.017/hr, memory ~$0.008/hr, total ~$0.03/hr.

Detailed compliance report with CIS checks:

Issues detected for privileged containers, wildcard roles, access to pods, etc.

Severity levels: High & Medium.

Provides actionable recommendations to improve cluster security posture.

Updated monthly cost reported: ~$112.00/mo.

Shows CPU, memory usage, and compliance results alongside cost data.

7) Key Observations

Cluster onboarded successfully in CAST AI console.

Agent pods deployed and reporting metrics.

Cost monitoring & optimization dashboard active.

Autoscaler components (castai-live, castai-workload-autoscaler) installed and running.

IAM integration complete with IRSA role ARN.

Compliance reports provide immediate insights into cluster posture.

8) Next Steps

Monitor savings report for optimization insights.

Fine-tune Spot instance % and autoscaling policies.

Gradually extend automation from staging workloads to production workloads.

Resolve CIS compliance gaps step by step.

Disable native Kubernetes Cluster Autoscaler or Karpenter to avoid conflicts.

9) Rollback Instructions
helm uninstall castai-agent -n castai-agent
helm uninstall castai-cluster-controller -n castai-agent
kubectl delete namespace castai-agent

Remove IAM role and policies if CAST AI write permissions are no longer required.

Conclusion

With these steps, CAST AI was successfully integrated with an EKS cluster, enabling cost monitoring, autoscaling, optimization, and compliance checks. This end-to-end setup provides both visibility and automation to optimize Kubernetes workloads on AWS.

Prithiviraj Rengarajan
DevOps Engineer

Top comments (0)