OpenShift 4.9 Prometheus DataSource error

I have installed the Grafana operator v4.1.1 on my OpenShift 4.9 without problems.
I have created an instance of Grafana v7.5.11 with tls route with success also.
I can connect to the instance using the https url specifed and login with the user/pass specified too
I have tried two methods to create datasource connected to openshift-monitoring prometheus
1- Add user/pass in prometheus-k8s-htpasswd (Install Grafana Operator on OpenShift Container Platform 4 – techbeatly)
The problem with this method is that I can see the secret being patched alright, but it gets reset a minute later to original value with only the internal user defined. So the datasource configured with basic auth fails to connect.
2- By adding cluster-monitoring-view role to the user grafana-serviceaccount and using the bearer token. (Custom Grafana dashboards for Red Hat OpenShift Container Platform 4)
The problem with this method is that if I run a terminal on the grafana pod, it doesn’t run under grafana-serviceaccount but with a generic OCP user like this: 1000720000. So the datasource configured with httpHeader Authorization: ‘Bearer {TOKEN}’ does not connect.

Is there anyone that could give me some insight of what I do wrong or what else I could try?

Ok I got method 2 working.
add-cluster-role-to-user cluster-monitoring-view does not work
add-cluster-role-to-user view is working

I don’t know if the first one used to work and now doesn’t anymore…

1 Like