I came across topic entitled “how-to-configure-grafana-behind-reverse-proxy-ingress-nginx-controller” while searching for help. I too find myself in a similar boat when trying to access https://MyDomain/ through an Nginx Ingress Controller in a K8S cluster. Difference being I am recieving 400 Bad Request instead of 502 Bad Gateway.
I updated my grafana.ini with the domain name as described in this how-to tutorials:run-grafana-behind-a-proxy, but with no change in behavior. .
I also tried using ‘%(protocol)s://%(domain)s:%(http_port)s/’ as the root_url, but still no help.
The above link refers to configuration in the nginx ingress controller, but the implication is that it is “to proxy Grafana Live WebSocket connections”. As far as I know I am not utilizing Grafana Live Websocket connections, so is the nginx configuration still needed?
Since I am getting a 400 Bad Request and not 502 Bad Gateway, I was hoping there may be a different solution.
I am running ingress-nginx-controller for the reverse proxy in a minikube k8s cluster. I have configured the domain name in the Grafana configuration as described in the above tutorial, though I am not using the sub path.
The tutorial has further instruction for configuring NGINX which implies modification of an existing configuration. The tutorial does not provide guidance on how to fit it in an existing configuration. I have tried creating a custom template that is applied via a configMap. My trying to fit in the suggested configuration content resulted in either duplicate configuration lines (errors) or configuration lines that could be potentially included in all servers behind the proxy (its a template). Now I am trying to use snippets via annotations in the ingress resource. For example:
ah ok. IMO, running this setup on minikube + localhost could be the cause here. Have you tried setting this up on using a kubernetes management service from a cloud provider? Or even a VM running minikube that you could try and access externally? GKE and DigitalOcean K8s are my two go-tos for throwaway clusters. Also, here are some resources I found on using the nginx-ingress with minikube. Maybe they help w your troubleshooting?