我正在使用helm-charts在本地kube集群上设置Grafana服务器。我试图让它在子路径上工作,以便稍后在带有tls的生产环境中实现它,但我无法访问http://localhost:3000/grafana上的Grafana。
我已经尝试了互联网上所有关于为入口添加子路径的建议,但似乎都不起作用。
当我从http://localhost:3000/中删除root_url:http://localhost:3000/grafana时,Values.yaml上会显示Grafana登录屏幕
但是当我将root_url:http://localhost:3000/grafana重新添加到values.yaml文件中时,我看到下面附加的错误(接近本文末尾)。
root_url: http://localhost:3000/grafana and ingress as: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: {}我希望http://localhost:3000/grafana url会显示登录屏幕,但我看到以下错误:
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你能帮我修复values.yaml上的入口和root_url,让Grafana URL在/grafana上工作吗?
发布于 2019-05-13 23:02:54
查看Configuring grafana behind Proxy文档时,应在grafana.ini文件的[server]部分下配置root_url。您可以修改您的values.yaml来实现这一点。
grafana.ini:
...
server:
root_url: http://localhost:3000/grafana/另外,值的入口应该如下所示。
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /
labels: {}
path: /grafana/
hosts:
- ""希望能有所帮助。
发布于 2021-10-29 09:46:41
我完全遵循了@coolinuxoid提到的步骤,然而,当我试图通过点击http://localhost:3000/grafana/来访问UI时,我仍然遇到了问题
我被重定向到http://localhost:3000/grafana/login,没有显示任何UI。
一个小的修改帮助我实现了通过http://localhost:3000/grafana/访问UI
在grafana.ini配置中,我添加了"serve_from_sub_path: true",所以我的最终grafana.ini如下所示:
grafana.ini:
server:
root_url: http://localhost:3000/grafana/
serve_from_sub_path: true入口配置完全相同。如果是版本特定的问题,我不能确定,但我使用的是Grafana v8.2.1。
发布于 2021-04-22 00:30:13
您需要告诉grafana应用程序,它不是在根url / (默认)下运行的,而是在某个子路径下运行的。最简单的方法是通过GF_前缀环境变量:
grafana:
env:
GF_SERVER_ROOT_URL: https://myhostname.example.com/grafana
GF_SERVER_SERVE_FROM_SUB_PATH: 'true'
ingress:
enabled: true
hosts:
- myhostname.example.com
path: /grafana($|(/.*))
pathType: ImplementationSpecific上面的例子适用于kubernetes的nginx-ingress controller。根据您使用的入口控制器,您可能需要
path: /grafana
pathType: Prefix而不是。
https://stackoverflow.com/questions/56010759
复制相似问题