You don’t need custom config for that, just define a service for grafana with those settings and then add a balancer with a rule mapping /grafana to the service.
Thanks for the reply. I tried that but doesn’t work i.e. after adding the LB service to grafana and accessing the LB URL doesn’t bring up Grafana page.
I think for Grafana , reverse proxy need to be configured. I would like to know the haproxy configuration command to enable reverse proxy.
This is a little more than transparent reverse proxying, as Grafana still expects the requests to reach it with the root url of /. To achieve that, HAProxy needs to rewrite the URL used in the request and strip off the /grafana component before sending it on. I’m afraid I don’t have time to help formulate the configuration for that but this should give you a good idea of how to do so: http://blog.haproxy.com/2014/04/28/howto-write-apache-proxypass-rules-in-haproxy/.
If my understanding is correct, it’ll add the root URL to any links in response content, but not actually accept requests on it. The proxy needs to strip them. Not the best approach IMHO.
Perhaps a cheap shot questioning the requirements but could you use a unique sub-domain or domain name instead? I have HAProxy setup to serve Grafana, Kibana, Elastic, Prometheus and more routing on the sub-domain, so something like this;
Thanks for the reply. We want to run it as as suburl. Running Grafana behind haproxy would solve the issue but I was trying to use the rancher load balancer service for this purpose instead of creating another separate container for haproxy. But need information on configuring the same. I tried using the options in the above link but no luck getting it to work.