[英]Does Prometheus scrapes 1 pod on Kubernetes?
我在 Linux 服务器的 Kubernetes 上安装了带有 2 或 3 个 pod 的 Spring Boot 应用程序。 为了监控它,我也安装了 Prometheus。 目前,从应用程序到 Prometheus 的指标进展顺利。
但我怀疑 Prometheus 仅从一个 pod 中获取指标。 使用 Prometheus 配置文件中的如下作业,prometheus 是否仅从一个 pod 获取指标? 我怎样才能让普罗米修斯同时刮掉所有的豆荚?
- job_name: 'SpringBootPrometheusDemoProject'
metrics_path: '/SpringBootPrometheusDemoProject/actuator/prometheus'
scrape_interval: 5s
static_configs:
- targets: ['127.0.0.1:8080']
是的。 在这种情况下,您必须在 pod 中添加一些注释(如果它不存在)并使用kubernetes_sd_configs
而不是static_configs
。
你会在这里找到一个例子: https : //github.com/appscode/third-party-tools/blob/master/monitoring/prometheus/builtin/README.md#kubernetes-pod
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.