Prometheus
Prometheus is a prerequisite for OpenCost installation. OpenCost requires Prometheus for scraping metrics and data storage. For the installation of Prometheus please use the following command:
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.yaml
This will install Prometheus in the prometheus-system
namespace with default settings for use with OpenCost.
This Prometheus installation is based on the Prometheus Community Kubernetes Helm Chart and by default your Prometheus may scrape unnecessary metrics. For production, you may refer to the Kubecost user metrics list to filter with keep
and for reference look at the scrape config in the Kubecost installation chart.
If you are going to connect existing Prometheus instance which is already consuming KSM metrics, please consider visiting this page about KSM metrics emission because OpenCost currently implements the same architecture and you might get overlapping metrics.
At this point you can proceed to installing OpenCost.
Providing your own Prometheus
If you want to use your own Prometheus:
- Set the
PROMETHEUS_SERVER_ENDPOINT
environment variable to the address of your Prometheus server. - Add the scrapeConfig to it, using the preferred means for your Prometheus install (ie.
-f https://raw.githubusercontent.com/opencost/opencost/develop/kubernetes/prometheus/extraScrapeConfigs.yaml
). - Consider using the OpenCost Helm Chart for additional Prometheus configuration options.