helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

[kube-prometheus-stack] Grafana switching Org adds Port 3000 in URL of Grafana

Open Atomique opened this issue 1 year ago • 3 comments

Describe the bug a clear and concise description of what the bug is.

If have configured multiple Orgs and if I switch between them the Port of Grafana (:3000) gets added into the URL which leads into an browser error of course ("ERR_CONNECTION_REFUSED").

I tried to find something like prometheus.prometheusSpec.externalURL for Grafana but couldn't find it.

How Can I fix this issue?

What's your helm version?

v3.13.3

What's your kubectl version?

v1.28.2

Which chart?

prometheus-community/kube-prometheus-stack

What's the chart version?

55.5.0

What happened?

No response

What you expected to happen?

No response

How to reproduce it?

No response

Enter the changed values of values.yaml?

.... grafana: defaultDashboardsTimezone: Europe/Berlin adminPassword: <PW> ingress: enabled: true ingressClassName: nginx hosts: - sub.domain.tld persistence: type: pvc enabled: true storageClassName: ceph-filesystem accessModes: - ReadWriteMany ...

Enter the command that you execute and failing/misfunctioning.

helm upgrade --install $RELEASE_NAME $REPO_NAME/$RELEASE_NAME --namespace=$NAMESPACE --create-namespace --version=$RELEASE_VERSION -f values.yaml

Anything else we need to know?

No response

Atomique avatar Dec 28 '23 11:12 Atomique

The problem should get fixed by setting root_url in grafana.ini (Ref.). For example, with ingress host grafana.example.local and TLS:

grafana:
  grafana.ini:
    server:
      domain: grafana.example.local
      root_url: "https://%(domain)s/"

If using HTTP:

grafana:
  grafana.ini:
    server:
      domain: grafana.example.local
      root_url: "http://%(domain)s/"
      ## alternative:
      # root_url: "%(protocol)s://%(domain)s/"

zeritti avatar Dec 29 '23 17:12 zeritti

The problem should get fixed by setting root_url in grafana.ini (Ref.). For example, with ingress host grafana.example.local and TLS:

grafana:
  grafana.ini:
    server:
      domain: grafana.example.local
      root_url: "https://%(domain)s/"

Thanks a lot, that one worked. But I wonder why this is needed now. Isn't this a default value?

Edit: Sorry closed this, but would be nice to get an idea why this happened. Will close this after it!

Atomique avatar Jan 03 '24 17:01 Atomique

Isn't this a default value?

No, it is not. The default root_url is set to

%(protocol)s://%(domain)s:%(http_port)s/

protocol, domain and http_port are configuration parameters of the server section with these defaults. The root URL can also be set via env variable GF_SERVER_ROOT_URL.

zeritti avatar Jan 04 '24 00:01 zeritti