简体   繁体   English

从单独的Prometheus服务器监视kubernetes集群及其所有服务,节点和Pod

[英]monitor kubernetes cluster and its all service, nodes and pods from separate prometheus server

My scenarios is like below 我的情况如下

There is one prometheus server and i want to monitor my devops servers, dev deployment (which is a kubernetes cluster with 10 pods), qa deployment and prod deployment. 有一个Prometheus服务器,我想监视我的devops服务器,开发部署(这是一个具有10个Pod的kubernetes集群),质量保证部署和产品部署。

I want to monitor all those deployments and devops servers by central prometheus server. 我想通过中央prometheus服务器监视所有这些部署和devops服务器。

I have seen couple of articles in this context. 在这种情况下,我看过几篇文章。 but they all refer setup prometheus on kubernetes cluster. 但是他们都引用了kubernetes集群上的setup prometheus。

Looking help on how to configure k8s clusters on separate prometheus server. 寻找有关如何在单独的prometheus服务器上配置k8s集群的帮助。

Based on question on Prometheus Github and it's documentation, the only optimal way to get data from several K8s cluster is to use Federation . 基于Prometheus Github及其文档的问题,从多个K8s集群获取数据的唯一最佳方法是使用Federation

You will have several Prometheus servers anyway (not only because of storing data, but also because, as example, processing custom resource which used for define check, see design document about how it works), but in Federation mode it is possible to use it's data together. 无论如何,您将拥有多个Prometheus服务器(不仅是因为存储数据,而且还因为例如处理用于定义检查的自定义资源 ,请参阅有关其工作方式的设计文档 ),但是在联合身份验证模式下,可以使用它数据在一起。

So, you can configure, as example, Hierarchical Federation of Prometheus. 因此,您可以配置Prometheus的层次联盟 In that mode you can use your separate Prometheus as a higher-level server, which will collect data from servers on the cluster. 在这种模式下,您可以将单独的Prometheus用作更高级别的服务器,该服务器将从群集中的服务器收集数据。

You can configure you server for get metrics from /federate endpoint of your Prometheus servers working on K8s clusters. 您可以配置服务器以从在K8s集群上工作的Prometheus服务器的/federate端点获取指标。

From article : 来自文章

- job_name: 'federate'
  scrape_interval: 15s

  honor_labels: true
  metrics_path: '/federate'

  params:
    'match[]':
      - '{job="prometheus"}'
      - '{__name__=~"job:.*"}'

  static_configs:
    - targets:
      - 'source-prometheus-1:9090'
      - 'source-prometheus-2:9090'
      - 'source-prometheus-3:9090'

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

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