How to connect a prometheus through openshift

Viewed 39

how to connect the Prometheus through Openshift. The log metrics should be visible in Prometheus. we have tried locally it is working there but we want in Openshift environment.

1 Answers

Accessing the Prometheus using Grafana requires cluster-monitoring-view permission to get metrics on the Prometheus.

  1. Create Service Account on a project.
$ oc create sa <Service Account Name>
  1. Give the role cluster-monitoring-view to the SA.
$ oc adm policy add-cluster-role-to-user cluster-monitoring-view -z <Service Account Name>
  1. Add Token of the SA as a bearer token into a prometheus datasource on Grafana.
$ oc sa get-token <Service Account Name>
"Authorization: bearer <TOKEN>"
Related