Install Kubecost on Redhat OpenShift
Currently, there are two main options to deploy Kubecost on Red Hat OpenShift Cluster (OCP).
Kubecost is installed with Cost Analyzer and Prometheus as a time-series database. Data is gathered by the Prometheus installed with Kubecost (bundled Prometheus). Other metrics are scraped by bundled Prometheus from OCP monitoring stack managed components like Kube State Metrics (KSM), Openshift Service Mesh (OSM), CAdvisor, etc .... Kubecost then pushes and queries metrics to/from bundled Prometheus. Enterprise setup could also work with Thanos as an additional component.
The standard deployment is illustrated in the following diagram:

Standard deployment
Kubecost is installed with the core components only (cost model, frontend) without bundled Prometheus and other components. Grafana agent is installed as part of the solution to scrape the metrics from OCP monitoring stack managed components and Kubecost
/metrics
endpoint to write the data back to the Grafana Cloud managed Prometheus (Grafana Prometheus) instance. Kubecost reads the metrics directly from Grafana managed Prometheus.The Grafana managed Prometheus deployment is illustrated in the following diagram:

Grafana managed Prometheus deployment
- You have an existing OpenShift cluster.
- You have appropriate access to that OpenShift cluster to create a new project and deploy new workloads.
Run the following Helm install command to install Kubecost:
helm upgrade --install kubecost \
--repo https://raw.githubusercontent.com/kubecost/openshift-helm-chart/main cost-analyzer \
--namespace kubecost --create-namespace \
-f https://raw.githubusercontent.com/kubecost/openshift-helm-chart/main/values-openshift.yaml
If you want to install Kubecost with your desired cluster name, you can use the following commands:
Note: Remember to replace CLUSTER_ID's value by your desired value
export CLUSTER_ID="CLUSTER_OCP"