[英]Kubernetes | Monitor HPA's Current and Target CPU Utilization using Prometheus
[英]Prometheus using multiple target
我們需要使用 prometheus 監視多個目標,當我們有一個簡短的目標列表時,修改不是問題,但是我們需要從不同的集群中添加許多目標(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 記錄而不是 static_configs。
使用 SRV 記錄,您只需定義一個dns_sd_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 記錄定義了要使用的端口。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.