我正在Istio中使用在AKS中启用了Grafana的功能,并且想要使用类似example.com/metrics/grafana
的子路径。提供的istio documentation仅说明如何在没有子路径但有子域的情况下使用它。但这不是这里的选择。
根据这个grafana tutorial我必须设置
domain = example.com
root_url = %(protocol)s://%(domain)s:%(http_port)s/metrics/grafana/
serve_from_sub_path = true
所以我已经在IstioOperator
中设置了它们:apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
profile: default
values:
[...]
grafana:
# Enable Grafana deployment for analytics and monitoring dashboards
enabled: true
env:
GF_SERVER_ROOT_URL: "%(protocol)s://%(domain)s/metrics/grafana/"
GF_SERVER_DOMAIN: "example.com"
GF_SERVER_SERVE_FROM_SUB_PATH: "true"
另外我设置了一个VirtualService
- name: grafana-route
match:
- uri:
prefix: /metrics/grafana/
route:
- destination:
host: grafana.istio-system.svc.cluster.local
port:
number: 3000
但是当我访问example.com/metrics/grafana时,我不断收到消息:有人知道可能是什么问题吗?
最佳答案
经过大量测试并阅读了文档,我发现了:serve_from_sub_path
必须设置为false
。
grafana:
# Enable Grafana deployment for analytics and monitoring dashboards
enabled: true
env:
GF_SERVER_ROOT_URL: "%(protocol)s://%(domain)s/metrics/grafana/"
GF_SERVER_DOMAIN: "example.com"
GF_SERVER_SERVE_FROM_SUB_PATH: "false"
此外,uri必须重写: - name: grafana-route
match:
- uri:
exact: /management/grafana
- uri:
prefix: /management/grafana/
rewrite:
uri: /
route:
- destination:
host: grafana.istio-system.svc.cluster.local
port:
number: 3000
关于kubernetes - Istio-具有SubPath的Grafana “if you'重新看到此grafana无法加载其应用程序文件”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/63054402/