我已经在群集A(主舞会)上安装了Prometheus operator 0.34
(按预期工作)现在我想使用federation选项,我的意思是从位于其他K8S集群B
上的其他Prometheus收集度量
Secnario:
- 具有群集A主要prometheus operator
v0.34
config - 我在群集中[[B从站prometheus
2.13.1
config
两者都通过Helm成功安装,我可以通过port-forwarding
访问localhost,并查看每个群集上的抓取结果。我做了以下步骤
在操作员上使用(主群集A)additionalScrapeconfig我已经将以下内容添加到values.yaml
文件中,并通过头盔对其进行了更新。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
我采取了如下目标:关于
集群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
将指标暴露在外部,这可能很好进行测试,但是我需要- secure it,该怎么做?如何使e2e以安全方式 ...工作
tlstype:LoadBalacer
内部
集群A(主集群),我们将证书用于带有https://prometheus.io/docs/prometheus/1.8/configuration/configuration/#tls_config的出站服务,如下所示,该方法有效]istio
我看到文档中有一个配置选项
tls:
mode: SIMPLE
privateKey: /etc/istio/oss-tls/tls.key
serverCertificate: /etc/istio/oss-tls/tls.crt
但是不确定我需要在prometheus运算符config中使用哪个证书,主要prometheus A或从属B的证书
我已经在群集A(主舞会)上安装了Prometheus运算符0.34(可以正常工作),现在我想使用联合身份验证选项,我的意思是从位于...]上的其他Prometheus收集度量标准。 [
您应考虑使用
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
- Additional Scrape Configuration允许指定密钥的密钥包含其他Prometheus抓取配置。刮指定的配置将附加到生成的配置中由Prometheus运算符。
我很抱歉,这没有得到正式支持。但是,您可以在Helm图表中更新AdditionalScrapeConfigs
部分。如果您想了解更多信息,请查看prometheus.yml
我在这里看到两个选项:
与Prometheus及其出口商的连接未加密,默认情况下经过身份验证。 this blog。
或指定This is one way of fixing that with TLS
certificates and
stunnel,您可以将其添加到您的抓取配置中。请让我知道是否有帮助。
想到几个选择:
将两个群集放在相同的网络空间中,并在它们前面放置防火墙
集群之间的VPN隧道。- 使用istio多集群路由(但这可能会变得复杂):Secrets