grafana error reverse proxy settings on istio

前言

搬project,就想乾脆上istio了,
然後就卡到怎麼以前的grafana開的起來,現在的開不起來。

正文

照以前的方式設定完 root_url,
還是出現相同錯誤
184-fig.1.jpg

查文件後才發現,
應該是新版(9.5.5)需要加上serve_from_sub_path的參數,
如果碰到只加了root_url也是看到錯誤,就再加個參數吧。

grafana.ini

[server]
root_url = "http://<ip>/grafana/"
serve_from_sub_path = true

virtualservice.yaml

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: istio-virtualservice
  namespace: istio-system
spec:
  hosts:
  - "<ip>"
  gateways:
    - istio-system/istio-gateway
  http: 
  - name: "grafana"
    match:
      - uri:
          prefix: /grafana/
      - uri:
          exact: /grafana
    route:
      - destination:
          port:
            number: 3000
          host:  grafana.istio-system.svc.cluster.local  

ref. Run Grafana behind a reverse proxy