前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >基于k8s集群部署prometheus监控ingress nginx

基于k8s集群部署prometheus监控ingress nginx

作者头像
仙人技术
发布2020-04-28 16:18:01
3.3K0
发布2020-04-28 16:18:01
举报

1、背景和环境概述

本文中涉及到的环境中、prometheus监控和grafana基本环境已部署好。 在nginx ingress controller的官方文档中对监控有相应描述 https://kubernetes.github.io/ingress-nginx/user-guide/monitoring/

2、修改prometheus配置

修改prometheus的配置,增加对ingress nginx的监控配置,可按照官方yaml 进行修改:

代码语言:javascript
复制
vim prometheus-configmap.yaml
- job_name: 'ingress-nginx-endpoints'
  kubernetes_sd_configs:
  - role: pod
    namespaces:
      names:
      - ingress-nginx
  relabel_configs:
  - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
    action: keep
    regex: true
  - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scheme]
    action: replace
    target_label: __scheme__
    regex: (https?)
  - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
    action: replace
    target_label: __metrics_path__
    regex: (.+)
  - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
    action: replace
    target_label: __address__
    regex: ([^:]+)(?::\d+)?;(\d+)
    replacement: $1:$2
  - source_labels: [__meta_kubernetes_service_name]
    regex: prometheus-server
    action: drop

重新apply一下configmap

代码语言:javascript
复制
kubectl apply -f prometheus-configmap.yaml

3、检查是否生效

打开prometheus界面,查看target中是否有ingress nginx的相关记录

检查查询取值

4、配置grafana图形

在grafana图形中导入模板,模板可以按照官方给出的json文件操作,下载此json文件,在grafana中导入即可

查看图形

至此,prometheus监控ingress nginx完成。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-08-03,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、背景和环境概述
  • 2、修改prometheus配置
  • 3、检查是否生效
  • 4、配置grafana图形
相关产品与服务
Grafana 服务
Grafana 服务(TencentCloud Managed Service for Grafana,TCMG)是腾讯云基于社区广受欢迎的开源可视化项目 Grafana ,并与 Grafana Lab 合作开发的托管服务。TCMG 为您提供安全、免运维 Grafana 的能力,内建腾讯云多种数据源插件,如 Prometheus 监控服务、容器服务、日志服务 、Graphite 和 InfluxDB 等,最终实现数据的统一可视化。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档