[英]Prometheus does not show metrics of all pods
When we use Kubernetes for production and we have a scaled application with many pods and publish as a service, every single metrics fetching request of Prometheus is routed to a pod with a random of selection. 当我们使用Kubernetes进行生产时,我们有一个包含许多Pod的规模化应用程序并作为服务发布,将Prometheus的每个单个指标获取请求路由到一个随机选择的Pod。 In this situation, results are not true for monitoring.
在这种情况下,监视结果不正确。
In a moment we need all pods metrics (for example 10 pod) and it's not possible by calling a Kubernetes Service endpoint! 暂时我们需要所有Pod指标(例如10个pod),并且无法通过调用Kubernetes Service端点来实现! Is there any solution for this problem?
这个问题有什么解决办法吗?
You can configure your kubernetes_sd_configs
so it scrapes the pods individually and not just the service. 您可以配置
kubernetes_sd_configs
以便它单独kubernetes_sd_configs
Pod,而不仅仅是服务。 To do that, set the role
to pod
, like this: 为此,将
role
设置为pod
,如下所示:
- job_name: 'kubernetes-pods'
kubernetes_sd_configs:
- role: pod
See this blog post for a full config example. 有关完整的配置示例, 请参见此博客文章 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.