Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kubernetes 普罗米修斯使用多目标_Kubernetes_Prometheus_Prometheus Operator - Fatal编程技术网

Kubernetes 普罗米修斯使用多目标

Kubernetes 普罗米修斯使用多目标,kubernetes,prometheus,prometheus-operator,Kubernetes,Prometheus,Prometheus Operator,当我们有一个简短的目标列表时,我们需要用普罗米修斯监控几个目标 修改不是一个问题,但是我们需要添加来自不同簇的许多目标(50-70个新目标) 我的问题是,是否有更优雅的方式来实现这一点 而不是像这样使用它 - job_name: blackbox-http # To get metrics about the exporter’s targets metrics_path: /probe params: module: [http_2xx] static_configs:

当我们有一个简短的目标列表时,我们需要用普罗米修斯监控几个目标 修改不是一个问题,但是我们需要添加来自不同簇的许多目标(50-70个新目标) 我的问题是,是否有更优雅的方式来实现这一点 而不是像这样使用它

- job_name: blackbox-http # To get metrics about the exporter’s targets
  metrics_path: /probe
  params:
    module: [http_2xx]
  static_configs:
    - targets:
      - http://clusterA   
      - https://clusterA   
      - http://clusterB 
      - http://clusterC 
      - http://clusterC 
        ...
可能要为每个集群挂载额外的文件,我的意思是提供一个仅针对clusterA的目标文件和仅针对clusterB的新文件,等等,是否可能


对于作业也是一样,当目标列表不断增加或变化时,从文件装载每个作业。管理作业定义的最佳方法是使用SRV记录,而不是静态配置

对于SRV记录,您只需定义一个
dns\u sd\u config
,其中只有一个目标将使用dns查询进行解析,那么您无需在每次添加新目标时更改配置,只需将其添加到dns记录中即可

根据您的问题改编的文档中的一个示例:

- job_name: 'myjob'
  metrics_path: /probe
  params:
    module: [http_2xx]
  dns_sd_configs:
  - names:
    - 'telemetry.http.srv.example.org'
    - 'telemetry.https.api.srv.example.org'
您可以使用内部DNS服务来生成这些记录,如果您的目标是
http
https
混合,则可能需要有两个记录,因为SRV记录定义了要使用的端口