我想通过HTTPS通过互联网联系Prometheus Operator。
我通过 HELM 部署了 Prometheus,并提供了以下 custom-vault.yml
图表版本:
kube-prometheus-0.0.105
nginx-ingress-0.31.0
部署:
helm install coreos/kube-prometheus --name kube-prometheus --set global.rbacEnable=false
--namespace monitoring -f custom-vault.yml
我的期望: 我想通过网址浏览普罗米修斯 https://example.com/prometheus
我的自定义保险库.yml
prometheus:
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /
tls:
- secretName: tls-secret
hosts:
- example.com
hosts:
- example.com
paths:
- /
#prometheusSpec:
#externalUrl: https://example.com/prometheus
发生什么事了?
我可以到达 https://example.com/graph 但由于路径错误而无法加载 CSS 文件。
当我尝试配置 https://example.com/prometheus/graph 时,CSS 也不起作用,当我单击警报上的前端时,我被重新定位为 https://example.com/alerts 并得到"默认后端 404"错误。
薮猫服务/Pod 的其他入口路由正在工作 普罗米修斯也在工作 - 当我将端口暴露给本地主机时,普罗米修斯会正确显示。
感谢您的输入。你帮我解决了问题。不是直接的方式,但它给了我一个新的观点。
我如何解决这个问题:我将部署从coreos/kube-prometheus更改为stable/prometheus-operator
当前版本是 6.11 我无法直接安装 6.11 - 我需要安装 6.0.0 并升级到 6.11
还提供了一个新的自定义值.yaml
使用此设置,它可以完美地工作!
custom-value.yaml
prometheus:
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/whitelist-source-range: "{my_whitelisted_public_ip}"
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
tls:
- secretName: tls-secret
hosts:
- example.com
hosts:
- example.com
paths:
- /
prometheusSpec:
externalUrl: http://example.com/prometheus
routePrefix : prometheus/
谢谢。
BR
您的网址是:"https://example.com/prometheus",路径是"/">
这就解释了为什么你可能有一些工作链接而不是其他链接(CSS,索引......
如果我没有错,你应该像这样创建你的路径:
paths:
- /prometheus/*
也就是说,结合您的重写目标以使用/prometheus 作为其根 url 并接受所有子 url。重写将在 Pod 内部重定向到/。
更改部分
paths:
- /
自
paths:
- prometheus:
path: /prometheus
但您应该记住,通过入口对象公开 Prometheus Web UI 需要一个正在运行的入口控制器。
您可以在此处找到更多信息:运算符-普罗米修斯-核心。