Skip to content

Go + React/Vite dashboard that polls ClusterCost agents to show real-time Kubernetes cost and resource insights, packaged for local run, Docker, and K8s deploys.

License

Notifications You must be signed in to change notification settings

ClusterCost/clustercost-dashboard

Repository files navigation

ClusterCost Dashboard

ClusterCost Dashboard is an open-source, local-first observability surface for real-time Kubernetes cost visibility. It runs a lightweight Go backend with an embedded React + Vite frontend, talks directly to ClusterCost agents, and ships with Docker and Kubernetes deployment assets.

Features

  • Go backend with cached polling of ClusterCost agents.
  • React + Vite + Tailwind + shadcn/ui frontend with a collapsible sidebar, responsive cards, and mobile-friendly tables.
  • REST API: /api/overview, /api/namespaces, /api/pods, /api/nodes, /api/workloads, /api/agents, /api/health.
  • Multi-stage Dockerfile and Kubernetes manifests for quick deployment.
  • Modern chart utilities powered by shadcn blocks so every dashboard (Overview, Namespaces, Nodes, Resources) shares the same look & feel.

Getting Started

Prerequisites

  • Go 1.21+
  • Node.js 18+
  • ClusterCost agents reachable from the dashboard

Configuration

Set agents via CONFIG_FILE (YAML) or a comma-separated AGENT_URLS env variable.

listenAddr: ":8080"
pollInterval: 30s
agents:
  - name: prod-cluster
    baseUrl: http://clustercost-agent-k8s.prod.svc.cluster.local:8080
    type: k8s

Environment overrides:

Variable Description
LISTEN_ADDR HTTP listen address (default :9090)
POLL_INTERVAL Poll frequency, e.g. 30s
CONFIG_FILE Path to YAML config
AGENT_URLS Comma-separated agent base URLs (k8s)

Backend

LISTEN_ADDR=:9090 go run ./cmd/dashboard

Frontend

cd web
npm install
npm run dev

The Vite dev server proxies API calls to localhost:8080. When you run npm run build, the generated assets are automatically copied into internal/static/dist so the Go binary can embed the latest frontend.

Agent API

The dashboard polls each configured agent via the /agent/v1/* endpoints for health & cost data. Review AGENTS.md for payload details and tips on running agents locally.

Docker

docker build -f deployments/docker/Dockerfile -t clustercost/dashboard .
docker run -p 8080:8080 clustercost/dashboard

Kubernetes

Apply the ConfigMap, Deployment, and Service in deployments/k8s/ after updating the agent URL to match your cluster.

kubectl apply -f deployments/k8s/configmap.yaml
kubectl apply -f deployments/k8s/deployment.yaml
kubectl apply -f deployments/k8s/service.yaml

Project Structure

  • cmd/dashboard: Go entrypoint.
  • internal: configuration, agent client, cache, API handlers, static serving.
  • web: React frontend.
  • deployments: Docker and Kubernetes artifacts.
  • AGENTS.md: documentation for the expected agent API payloads.

License

MIT © ClusterCost

About

Go + React/Vite dashboard that polls ClusterCost agents to show real-time Kubernetes cost and resource insights, packaged for local run, Docker, and K8s deploys.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published