<p>I am setting up a Grafana server on my local kube cluster using helm-charts. I am trying to get it to work on a subpath in order to implement it on a production env with tls later on, but I am unable to access Grafana on <a href="http://localhost:3000/grafana" rel="nofollow noreferrer">http://localhost:3000/grafana</a>. </p>

<p>I have tried all most all the recommendations out there on the internet about adding a subpath to ingress, but nothing seems to work. </p>

<p>The Grafana login screen shows up on <a href="http://localhost:3000/" rel="nofollow noreferrer">http://localhost:3000/</a> when I remove root_url: <a href="http://localhost:3000/grafana" rel="nofollow noreferrer">http://localhost:3000/grafana</a> from Values.yaml</p>

<p>But when I add root_url: <a href="http://localhost:3000/grafana" rel="nofollow noreferrer">http://localhost:3000/grafana</a> back into values.yaml file I see the error attached below (towards the end of this post).</p>

<pre><code>root_url: http://localhost:3000/grafana and ingress as:
</code></pre>

<pre><code>ingress:
  enabled: true
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /

  labels: {}
  path: /grafana
  hosts:
    - localhost
  tls: []
  #  - secretName: chart-example-tls
  #    hosts:
  #      - chart-example.local

resources: {}
</code></pre>

<p>I expect the <a href="http://localhost:3000/grafana" rel="nofollow noreferrer">http://localhost:3000/grafana</a> url to show me the login screen instead i see the below errors:</p>

<pre><code>If you're seeing this Grafana has failed to load its application files 

1. This could be caused by your reverse proxy settings.

2. If you host grafana under subpath make sure your grafana.ini root_url setting includes subpath

3. If you have a local dev build make sure you build frontend using: yarn start, yarn start:hot, or yarn build

4. Sometimes restarting grafana-server can help

</code></pre>

<p>Can you please help me fix the ingress and root_url on values.yaml to get Grafana URL working at /grafana ?</p>

Lokesh Sreedhar
<p>As you check documentation for <a href="https://grafana.com/docs/installation/behind_proxy/" rel="nofollow noreferrer">Configuring grafana behind Proxy</a>, <code>root_url</code> should be configured in <code>grafana.ini</code> file under <code>[server]</code> section. You can modify your <code>values.yaml</code> to achieve this.</p>

<pre><code>grafana.ini:
  ...
  server:
    root_url: http://localhost:3000/grafana/
</code></pre>

<p>Also your ingress in values should look like this.</p>

<pre><code>ingress:
  enabled: true
  annotations: 
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
  labels: {}
  path: /grafana/
  hosts:
    - ""
</code></pre>

<p>Hope it helps. </p>
