简体   繁体   English

Prometheus 是否会在 Kubernetes 上抓取 1 个 pod?

[英]Does Prometheus scrapes 1 pod on Kubernetes?

I installed my Spring Boot application with 2 or 3 pods on Kubernetes in Linux Server.我在 Linux 服务器的 Kubernetes 上安装了带有 2 或 3 个 pod 的 Spring Boot 应用程序。 And to monitor it, I installed Prometheus, too.为了监控它,我也安装了 Prometheus。 Currently, the metrics from application to Prometheus go very well.目前,从应用程序到 Prometheus 的指标进展顺利。

But I suspect that Prometheus takes metrics from only one pod.但我怀疑 Prometheus 仅从一个 pod 中获取指标。 With a job like below in Prometheus config file, does prometheus takes metrics only from one pod?使用 Prometheus 配置文件中的如下作业,prometheus 是否仅从一个 pod 获取指标? How can I make Prometheus scrape all pods in same time?我怎样才能让普罗米修斯同时刮掉所有的豆荚?

- job_name: 'SpringBootPrometheusDemoProject'
  metrics_path: '/SpringBootPrometheusDemoProject/actuator/prometheus'
  scrape_interval: 5s
  static_configs:
  - targets: ['127.0.0.1:8080']

Yes.是的。 In this case, you have to add few annotations in your pod (if it does not exist already) and use kubernetes_sd_configs instead of static_configs .在这种情况下,您必须在 pod 中添加一些注释(如果它不存在)并使用kubernetes_sd_configs而不是static_configs

You will find an example here: https://github.com/appscode/third-party-tools/blob/master/monitoring/prometheus/builtin/README.md#kubernetes-pod你会在这里找到一个例子: https : //github.com/appscode/third-party-tools/blob/master/monitoring/prometheus/builtin/README.md#kubernetes-pod

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM