OpenCost as a Prometheus metric exporter
Running OpenCost as a Prometheus metric exporter allows you to export various cost metrics to Prometheus without setting up any other OpenCost dependencies. Doing so lets you write PromQL queries to calculate the cost and efficiency of any Kubernetes concept, e.g. namespace, service, label, deployment, etc. You can also calculate the cost of different Kubernetes resources, e.g. nodes, PVs, LoadBalancers, and more. Finally, you can do other interesting things like create custom alerts via AlertManager and custom dashboards via Grafana.
Prometheus OpenCost Exporter Helm Chart
The Prometheus OpenCost Exporter is available within the Prometheus Community Kubernetes Helm Charts repository. This provides the Prometheus metric exporter capabilities without the OpenCost UI or any other additional capabilities. It is maintained as part of the regular OpenCost release process and regularly updated.
Prerequisites
- Kubernetes 1.23+
- Helm 3+
Add Helm Chart Repository
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
Install Chart
helm install [RELEASE_NAME] prometheus-community/prometheus-opencost-exporter
Uninstall Chart
helm uninstall [RELEASE_NAME]
This removes all the Kubernetes components associated with the chart and deletes the release.
Upgrading Chart
For minor version upgrades:
helm upgrade [RELEASE_NAME] [CHART] --install