Prometheus仪表板通过入口控制器公开 [英] Prometheus dashboard exposed over ingress controller
问题描述
我正在尝试在k8集群中设置Prometheus,使其能够使用头盔运行.当我使用外部ip将prometheus-server作为LoadBalancer服务公开时,访问仪表板. 当我尝试将此服务配置为ClusterIP并使用入口控制器将其配置为后端时,同样的方法不起作用.收到404错误,对如何解决此问题有何想法?
I am trying to setup Prometheus in k8 cluster, able to run using helm. Accessing dashboard when i expose prometheus-server as LoadBalancer service using external ip. Same does not work when I try to configure this service as ClusterIP and making it as backend using ingress controller. Receiving 404 error, any thoughts on how to troubleshoot this?
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ops-ingress
annotations:
#nginx.org/server-snippet: "proxy_ssl_verify off;"
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
rules:
- http:
paths:
- path: /prometheus(/|$)(.*)
backend:
serviceName: prometheus-server
servicePort: 80
在具有上面的入口定义的情况下,URL"http://<>/prometheus/被重定向到http://<>/graph/,然后呈现404错误页面.将url调整为http://<>/prometheus/graph时,某些Web控件在浏览器控制台上呈现很多错误.
with above ingress definition in place, url "http://<>/prometheus/ getting redirected to http://<>/graph/ and then 404 error page getting rendered. When url adjusted to http://<>/prometheus/graph some of webcontrols gets rendered with lots of errors on browser console.
推荐答案
Prometheus可能希望控制根路径(/).
Prometheus might be expecting to have control over the root path (/).
请将Ingress更改为prometheus.example.com
,它应该可以正常工作. (将其更改为子域)
Please change the Ingress to prometheus.example.com
and it should work fine. (Changing it to a subdomain)
这篇关于Prometheus仪表板通过入口控制器公开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!