- Purpose: An open-source, CNCF-incubating project for real-time cost monitoring across containerized environments and multi-cloud setups
- Features: Offers cost allocation by Kubernetes entities (namespace/pod), integrates with billing APIs for AWS/Azure/GCP, and supports on-prem clusters with custom pricing
- Strengths: Great for comprehensive, real-time visibility into cluster-level costs and multi-cloud billing standardization
- Use case: Ideal for operations teams needing detailed cost breakdown in Kubernetes environments and aggregated cloud spend.
kubectl create ns opencost
kubectl create secret generic cloud-costs --from-file=./k8s/cloud-integration.json --namespace opencosthelm repo add opencost https://opencost.github.io/opencost-helm-chart
helm upgrade -i opencost \
--repo https://opencost.github.io/opencost-helm-chart opencost \
--namespace opencost --create-namespace \
--version 1.43.2 \
-f k8s/helm/values-kind.yamlPricing info for aws: https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/${node_region}/index.json
install scrape configs
helm install prometheus --repo https://prometheus-community.github.io/helm-charts prometheus \
--namespace prometheus-system --create-namespace \
--set prometheus-pushgateway.enabled=false \
--set alertmanager.enabled=false \
-f https://raw.githubusercontent.com/opencost/opencost/develop/kubernetes/prometheus/extraScrapeConfigs.yamladditionalScrapeConfigs: |
- job_name: opencost
honor_labels: true
scrape_interval: 1m
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
dns_sd_configs:
- names:
- opencost.opencost
type: 'A'
port: 9003