I try to run grafana and nginx as reverse proxy in a kubernetes cluster and I already found this answer but this seems not to work for me. At least I get the same {{alert.title}}-Message as Oles. That's why I would like ask again and maybe someone can give me a hint what I am doing wrong?
The configuration for the grafana deployment contains the following part:
env:
- name: GF_SERVER_DOMAIN
value: "k8s-4"
- name: GF_SERVER_ROOT_URL
value: "http://k8s-4/grafana"
and I don't modify the grafana.ini inside the container/pod.
Further I configure the nginx in the default.conf as following:
server {
listen 80;
server_name localhost k8s-4;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /grafana/ {
proxy_pass http://k8s-4:30080/grafana;
proxy_set_header X-Forwarded-Host k8s-4;
proxy_set_header X-Forwarded-Server k8s-4;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
But as I say above this leads to the alert.title Error. But if I set the context to the root Element and configured the tools as follows:
deployment:
env:
- name: GF_SERVER_DOMAIN
value: "k8s-4"
- name: GF_SERVER_ROOT_URL
value: "http://k8s-4"
nginx - default.conf
server {
listen 80;
server_name localhost k8s-4;
location / {
proxy_pass http://k8s-4:30080/grafana;
proxy_set_header X-Forwarded-Host k8s-4;
proxy_set_header X-Forwarded-Server k8s-4;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /grafana/ {
}
}
it works... That's why I am quite sure this is a problem with the deployment of grafana but I don't see the error. Maybe someone here can give me a little hint?
Your first server
setup is almost correct, you need to change the proxy_pass
line to:
proxy_pass http://k8s-4:30080/;