当前位置: 首页 > 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.lryc.cn/news/624542.html

相关文章:

  • 电子电气架构 --- 软件会给汽车带来哪些变化?
  • Git+Jenkins 基本使用
  • cesium中实时获取鼠标精确坐标和高度
  • 开放最短路径优先协议
  • 在 CentOS 7 上使用 LAMP 架构部署 WordPress
  • 【秋招笔试】2025.08.16科大讯飞秋招机考真题
  • Unity爆炸力场实战指南
  • Avalonia实例实战七:动画
  • 文件读取的底层实现——generic_read_iter分析
  • 一个基于前端开发的经典飞机大战游戏,具有现代化的UI设计和流畅的游戏体验。
  • 【数据分析】R语言在生态学数据分析中的应用:从数据处理到可视化
  • 双指针从简单到复杂
  • 下划线字段在golang结构体中的应用
  • Drawnix:一款免费开源的白板工具,支持思维导图、流程图、类图和手绘图
  • 深入浅出讲透IPD:三层逻辑实例详解 —— 卫朋
  • 设计模式笔记_行为型_访问者模式
  • 【arXiv2025】计算机视觉|FGA:即插即用!让你的模型精准预测人群密度!
  • 微信小程序通过uni.chooseLocation打开地图选择位置,相关设置及可能出现的问题
  • 【深度学习】pytorch深度学习框架的环境配置
  • CPTS---Active 复现
  • 如何部署 PHPWind 8.5 UTF8 论坛?从下载到安装全流程(附安装包下载)
  • 20250818在荣品的PRO-RK3566开发板跑Buildroot的时候使用在线秒表https://tool.hiofd.com/stopwatch/
  • Python循环语句 从入门到精通
  • 【运维进阶】LNMP + WordPress 自动化部署实验
  • 第十六届蓝桥杯青少组C++省赛[2025.8.10]第二部分编程题(5、环形取硬币游戏)
  • Baumer高防护相机如何通过YoloV8深度学习模型实现网球运动员和网球速度的检测分析(C#代码UI界面版)
  • Opsqueue:为重负载而生的轻量级批处理队列,已开源!
  • Bellman-Ford与spfa算法简介
  • ARM架构下的cache transient allocation hint以及SMMUv2的TRANSIENTCFG配置详解
  • 大数据时代时序数据库选型指南:深度解析与 Apache IoTDB 实践