0

I use minikube to run a local kubernetes cluster. I deploy grafana using helm from this repo: https://grafana.github.io/helm-charts. If I use port-forwarding it is perfectly accessible, so I tried to setup an ingress on chart-example.local/grafana. When I curl chart-example.local/grafana it works as well. but when I use minnikube tunnel and localhost/grafana in my browser I get 404 Not Found nginx.

I made the following changes to the helm values file:

custom-values.yml:

ingress:
  enabled: true
  annotations: 
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /$1
    nginx.ingress.kubernetes.io/use-regex: "true"
  path: /grafana/?(.*)
  pathType: Prefix
  hosts:
   - chart-example.local

grafana.ini:
  server:
    domain: "{{ if (and .Values.ingress.enabled .Values.ingress.hosts) }}{{ .Values.ingress.hosts | first }}{{ else }}''{{ end }}"
    root_url: http://localhost:3000/grafana
    serve_from_sub_path: true

I also tried using root_url: root_url: "%(protocol)s://%(domain)s/grafana".

I have a feeling this is caused by the host key in the values.yml file. Or is the value I entered for root_url wrong?

Cake
  • 90
  • 1
  • 8
  • chart values don't say much. charts may change. the objects installed in kubernetes is what you should be looking at. And as a general rule: trusting charts is dangerous. Not only you don't know how to troubleshoot this: you have no idea what's been installed on your cluster, don't you? For all we know, you could have installed a shit-coin miner or broken security in your cluster – SYN Mar 29 '23 at 06:57
  • checked description of grafana deployment, service and ingress and all look exactly as expected. Also all changes in the values.yml are being applied. Do you know anything else I could check? – Cake Mar 29 '23 at 07:03
  • 1
    Confirm your curl reaches your ingress controller. From that ingress controller: confirm you can reach the service. Check ingress logs, grafana logs. Try to remove URL rewriting. I would avoid ".local" host names, as this may conflict with cluster DNS internal resolution. – SYN Mar 29 '23 at 07:08

1 Answers1

1

I could fix the problem by setting

ingress: 
 - hosts: ""

So the problem was the hosts tag, but I don't understand why it causes this problem. Does somebody know?

Cake
  • 90
  • 1
  • 8