当前位置: 首页 > news >正文

elasticsearch-集成prometheus监控(k8s)

 一. 简介: 

   关于elasticsearch的简介和部署,可以参考单独的文章elasticsearch基础概念与集群部署-CSDN博客,这里就不细说了。这里只讲讲如何在k8s中部署export并基于prometheus做es的指标采集。

二. 实现方式:

    首先我们需要先部署exporter采集器,提供给prometheus调用 ,这里我们选择在k8s中部署,好处是: k8s有健康检测机制,不需要独立维护exporter的故障问题。这里采用deployment的方式:

apiVersion: apps/v1
kind: Deployment
metadata:name: elastic-exporternamespace: monitoring
spec:replicas: 1strategy:rollingUpdate:maxSurge: 1maxUnavailable: 0type: RollingUpdateselector:matchLabels:app: elastic-exportertemplate:metadata:labels:app: elastic-exporterspec:containers:- command:- /bin/elasticsearch_exporter- --es.uri=http://elastic:xxxx@10.0.36.1:9200  #这里采用了认证方式,如果没有认证,可直接配置url地址,即;http://10.0.36.1:9200- --es.all  #采集集群所有节点的指标image: quay.io/prometheuscommunity/elasticsearch-exporter:latestsecurityContext:capabilities:drop:- SETPCAP- MKNOD- AUDIT_WRITE- CHOWN- NET_RAW- DAC_OVERRIDE- FOWNER- FSETID- KILL- SETGID- SETUID- NET_BIND_SERVICE- SYS_CHROOT- SETFCAPreadOnlyRootFilesystem: truelivenessProbe:httpGet:path: /healthzport: 9114initialDelaySeconds: 30timeoutSeconds: 10name: elastic-exporterports:- containerPort: 9114name: httpreadinessProbe:httpGet:path: /healthzport: 9114initialDelaySeconds: 10timeoutSeconds: 10resources:limits:cpu: 100mmemory: 128Mirequests:cpu: 25mmemory: 64MirestartPolicy: AlwayssecurityContext:runAsNonRoot: truerunAsGroup: 10000runAsUser: 10000fsGroup: 10000

部署svc:

apiVersion: v1
kind: Service
metadata:name: elastic-exporternamespace: monitoringlabels:app: elastic-exporter
spec:type: ClusterIPports:- port: 9114targetPort: 9114protocol: TCPname: elastic-exporterselector:app: elastic-exporter

配置prometheus的指标采集:

接下来,就可以验证指标了:

三. grafana中绘制dashboard看板:

    也可以通过网络上的开源模版,直接导入:

配置完成!

  ---------------------------------------------------------------------------------------

                         深耕运维行业多年,擅长运维体系建设,方案落地。欢迎交流!

                                                     V: ywjw996

                                                    《 运维经纬 》

 

http://www.dtcms.com/a/337185.html

相关文章:

  • 【iOS】锁的原理
  • Flutter 多功能列表项:图标、文字与Switch组合
  • Highcharts for Flutter 正式发布
  • 云原生俱乐部-docker知识点归纳(1)
  • MySQL的多版本并发控制(MVCC):
  • 【Java基础常见辨析】重载与重写,深拷贝与浅拷贝,抽象类与普通类
  • 基于 JSP+Mysql实现MVC房屋租赁系统
  • Word 中 MathType 公式编号问题与解决
  • 自定义table
  • SpringBoot--Spring MVC 拦截器注入与 new 的区别
  • OSCP - Proving Grounds - Vanity
  • 分布式系统的“不可能三角”:CAP定理深度解析
  • 【数据结构】堆中插入数据,删除数据
  • Android Handler 线程执行机制
  • python遇到异常流程
  • 【Langchain系列二】LangChain+Prompt +LLM智能问答入门
  • Unix Domain Socket(UDS)和 TCP/IP(使用 127.0.0.1)进程间通信(IPC)的比较
  • Baumer高防护相机如何通过YoloV8深度学习模型实现网球运动员和网球速度的检测分析(C#代码UI界面版)
  • Spring AI Alibaba 项目接入兼容 OpenAI API 的大模型
  • Midjourney绘画创作入门操作创作(在线教育背景系列)
  • IOPaint 远程修图:cpolar 内网穿透服务实现跨设备图片编辑
  • Ansible文件部署与大项目多主机管理
  • 【Git】windows系统删除同名路径
  • 机器翻译论文阅读方法:顶会(ACL、EMNLP)论文解析技巧
  • IntelliJ IDEA中Maven的“Sync“与“Reload“详解:小白的避坑指南
  • python DataFrame基础操作
  • 从零开始部署经典开源项目管理系统最新版redmine6-Linux Debian12
  • 链路聚合路由器OpenMPTCProuter源码编译与运行
  • 如何在 Ubuntu 24.04 安装 Python 3.12 ?
  • SpringAI集成MCP