Self-Hosted Installation
K8Cost can run entirely in your own Kubernetes cluster using our Helm chart.
Prerequisites
- Kubernetes 1.24+
- Helm 3.10+
- PostgreSQL 14+ (built-in or external)
- A K8Cost license key (get one here)
Quick Install
# Add the K8Cost Helm repository
helm repo add k8cost https://charts.k8cost.com
helm repo update
# Install with built-in PostgreSQL
helm install k8cost k8cost/k8cost \
--namespace k8cost \
--create-namespace \
--set config.licenseKey=YOUR_LICENSE_KEY
Verify Installation
# Check pods are running
kubectl get pods -n k8cost
# Expected:
# k8cost-0 1/1 Running
# k8cost-postgresql-0 1/1 Running
# Get the auto-generated admin password
kubectl get secret k8cost-secret -n k8cost \
-o jsonpath='{.data.admin-password}' | base64 -d
# Port-forward to access the dashboard
kubectl port-forward svc/k8cost 8080:80 -n k8cost
# Open http://localhost:8080
External PostgreSQL
helm install k8cost k8cost/k8cost \
--namespace k8cost \
--create-namespace \
--set postgresql.enabled=false \
--set config.database.url="postgres://k8cost:pass@your-db:5432/k8cost"
Ingress
# values-production.yaml
ingress:
enabled: true
className: nginx
hosts:
- host: k8cost.internal.company.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: k8cost-tls
hosts:
- k8cost.internal.company.com
helm install k8cost k8cost/k8cost -f values-production.yaml
Adding Remote Clusters
The self-hosted instance monitors its own cluster by default. To add remote clusters:
- Log into the K8Cost dashboard
- Go to Clusters → Add Cluster
- Copy the agent manifest
- Apply in the remote cluster:
kubectl apply -f k8cost-agent.yaml
Resource Requirements
| Component | CPU Request | Memory Request | Storage |
|---|---|---|---|
| K8Cost API | 100m | 256Mi | — |
| PostgreSQL | 250m | 512Mi | 10Gi |
| Agent CronJob | 50m | 128Mi | — |
For clusters with 500+ pods, increase API resources to 500m CPU / 1Gi memory.
Upgrading
helm repo update
helm upgrade k8cost k8cost/k8cost --namespace k8cost
Database migrations run automatically on startup.