Kubernetes Agent
The ClusterCost agent is a minimal, efficient Go binary that runs once per cluster. It calculates real-time cost estimates without heavy dependencies.
Architecture
Section titled “Architecture”The agent runs as a single Deployment (not a DaemonSet). It scrapes cluster state, matches it with pricing data, and exposes metrics locally.
- Core Pipeline: Informers cache cluster state (nodes, pods, namespaces).
- Usage Data: Fetches real-time usage from the Kubernetes Metrics API.
- Pricing: Applies offline-generated AWS pricing tables to calculate hourly costs.
How It Works
Section titled “How It Works”- Scrape Loop: Every 60s, the agent snapshots the cluster state.
- Cost Calculation:
- Converts CPU/Memory usage to hourly rates.
- Allocates node costs across running pods.
- Aggregates data by pod, namespace, workload, and label.
- Enrichment: Merges labels to create consistent keys for teams, services, and environments.
Data Collected
Section titled “Data Collected”The agent only talks to the Kubernetes API and Metrics API.
| Source | Data Points |
|---|---|
| Kubernetes API | Nodes (instance types, capacity), Namespaces, Pods (requests, owners). |
| Metrics API | Real-time CPU and Memory usage per pod. |
| Pricing Config | Embedded AWS pricing tables (generated offline). |
Outputs
Section titled “Outputs”The agent exposes data strictly within the cluster.
- Prometheus Metrics:
/metricsendpoint for scraping. - JSON API:
/api/cost/*endpoints for the local dashboard. - Health Checks:
/healthzand/readyzfor liveness probes.
Data Residency
Section titled “Data Residency”Your data never leaves the cluster.
The agent performs all calculations locally. It does not make outbound calls to AWS APIs or external SaaS platforms. Pricing data is embedded in the binary.