栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

prometheus operator federation

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

prometheus operator federation

全世界都告诉你修改 prometheus 的配置文件,把联邦的部分添加进去就好了。但我的是通过 operator 部署的丫。连 prometheus 配置文件的 configmap 都木有,那咋改文件文件呢? 难道我不属于全世界?

prometheus 通过 prometheus-operator 配置的,怎么样配置联邦呢?

先来个官网看看什么是联邦:

Federation | Prometheushttps://prometheus.io/docs/prometheus/latest/federation/

operator 添加 prometheus 的配置,这就是关键了,弄一个 secret,添加到 prometheus 的 cr 里面

prometheus-operator/additional-scrape-config.md at main · prometheus-operator/prometheus-operator · GitHubhttps://github.com/prometheus-operator/prometheus-operator/blob/main/documentation/additional-scrape-config.md

结合一下:

vi prometheus-additional.yaml

- job_name: 'federate'
  scrape_interval: 15s

  honor_labels: true
  metrics_path: '/federate'

  params:
    'match[]':
    #- '{job="prometheus"}'
    #- '{__name__=~"job:.*"}' 
    # 纯粹测试,所以简单粗暴,正儿八经的环境上可别这样
    - '{job!=""}'

  static_configs:
    - targets: ['172.30.3.229:9090']
      # 添加额外的 label, metrics-name{k8scluster="cluster-172.30.3.229"}
      labels:
        k8scluster: cluster-172.30.3.229
    - targets: ['172.30.3.230:9090']
      labels:
        k8scluster: cluster-172.30.3.230

其他按照文档继续操作下去就好了。

再来个可用的 dashboard

Kubernetes cluster monitoring (Prometheus) dashboard for Grafana | Grafana LabsMonitors Kubernetes cluster using Prometheus. Shows overall cluster CPU / Memory / Filesystem usage as well as individual pod, containers, systemd services...https://grafana.com/grafana/dashboards/7550

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/746876.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号