【发布时间】:2019-11-21 16:54:12
【问题描述】:
我已经在集群 A(主舞会)上安装了 Prometheus operator 0.34(按预期工作)
现在我想使用federation 选项,我的意思是从位于其他 K8S 集群的其他 Prometheus 收集指标 B
Secnario:
- 在集群 A 主prometheus operator
v0.34config- 我在集群 B SLAVE prometheus
2.13.1config
都通过 helm 安装成功,我可以通过 port-forwarding 访问 localhost 并查看每个集群的抓取结果。
我做了以下步骤
在算子上使用(主集群 A)additionalScrapeconfig
我已将以下内容添加到 values.yaml 文件并通过 helm 进行更新。
additionalScrapeConfigs:
- job_name: 'federate'
honor_labels: true
metrics_path: /federate
params:
match[]:
- '{job="prometheus"}'
- '{__name__=~"job:.*"}'
static_configs:
- targets:
- 101.62.201.122:9090 # The External-IP and port from the target prometheus on Cluster B
我的目标如下:
在 cluster B 内的 prometheus 上(我想从中收集数据)我使用:
kubectl get svc -n monitoring
并获得以下条目:
获取EXTERNAL-IP 并将其放入additionalScrapeConfigs 配置条目中。
现在我切换到集群 A 并运行 kubectl port-forward svc/mon-prometheus-operator-prometheus 9090:9090 -n monitoring
使用localhost:9090 打开浏览器查看图表并点击Status 然后点击Targets
并通过工作federate查看新目标
现在我的主要问题/差距。 (安全和验证)
- 为了能够看到绿色的目标
state(参见图片),我在集群B中配置prometheus 服务器,而不是使用type:NodePort来使用type:LoadBalacer,这会在外部公开指标,这可以是适合测试,但我需要保护它,怎么做? 如何使 e2e 以安全方式...
tls https://prometheus.io/docs/prometheus/1.8/configuration/configuration/#tls_config
在集群A(主集群)中,我们使用istio 的输出服务证书,如下所示
tls:
mode: SIMPLE
privateKey: /etc/istio/oss-tls/tls.key
serverCertificate: /etc/istio/oss-tls/tls.crt
我看到文档里面有一个配置选项
additionalScrapeConfigs:
- job_name: 'federate'
honor_labels: true
metrics_path: /federate
params:
match[]:
- '{job="prometheus"}'
- '{__name__=~"job:.*"}'
static_configs:
- targets:
- 101.62.201.122:9090 # The External-IP and port from the target
# tls_config:
# ca_file: /opt/certificate-authority-data.pem
# cert_file: /opt/client-certificate-data.pem
# key_file: /sfp4/client-key-data.pem
# insecure_skip_verify: true
但不确定我需要在 prometheus operator config 中使用哪个证书,主 prometheus A 或从 B 的证书?
【问题讨论】:
-
Stack Overflow 是一个编程和开发问题的网站。对于这个问题,您可能应该使用Stack Exchange network 上的另一个站点。另请参阅帮助中心内的What topics can I ask about here。
标签: security kubernetes prometheus istio prometheus-operator