I am running Grafana v6.2.4 in kubernetes. I want to use the k8s proxy for testing. I have changed the GF_SERVER_ROOT_URL
environment variable to "http://localhost:8080/api/v1/namespaces/my-namespace/services/grafana-prom:80/proxy/"
. This allows me to use Grafana through my browser at http://localhost:8080/api/v1/namespaces/my-namespace/services/grafana-prom:80/proxy/
. However, I want to use it via the API. If I send a request to http://localhost:8080/api/v1/namespaces/my-namespace/services/grafana-prom:80/proxy/api/dashboards/db
I get back the message “Unauthorized”. However, if I set up a kubernetes port foward and send the identical request to http://localhost:30099/api/dashboards/db
, then it succeeds. Is there a difference environment variable aside from GF_SERVER_ROOT_URL
that I should be changing so that the API server root goes through the k8s proxy, i.e. http://localhost:8080/api/v1/namespaces/my-namespace/services/grafana-prom:80/proxy/api/dashboards/db
?
This appears to be impossible as apparently kubectl proxy strips off authentication headers :’(. See here: https://stackoverflow.com/a/57762020/1011724