k8s集群监控方案--node-exporter+prometheus+grafana

目录

前置条件

一、下载yaml文件

二、部署yaml各个组件

2.1 node-exporter.yaml

2.2 Prometheus

2.3 grafana

2.4访问测试

三、grafana初始化

3.1加载数据源

3.2导入模板

四、helm方式部署


前置条件

安装好k8s集群(几个节点都可以,本人为了方便实验k8s集群只有一个master节点),注意prometheus是部署在k8s集群内部的,不同于传统监控分为监控端和被控端。

部署k8s参考教程:Linux部署单节点k8s_linux单节点安装k8s_luo_guibin的博客-CSDN博客

                               k8s集群环境的搭建 · 语雀

11.0.1.12

k8s-master / node-exporter+prometheus+grafana

一、下载yaml文件

链接:https://pan.baidu.com/s/1vmT0Xu7SBB36-odiCMy9zA  (链接永久有效

提取码:9999

解压

[root@prometheus opt]# yum install -y zip unzip tree
[root@prometheus opt]# unzip k8s-prometheus-grafana-master.zip 
[root@k8s-master k8s-prometheus-grafana-master]# pwd
/opt/k8s-prometheus-grafana-master
[root@k8s-master k8s-prometheus-grafana-master]# tree
.
├── grafana
│?? ├── grafana-deploy.yaml
│?? ├── grafana-ing.yaml
│?? └── grafana-svc.yaml
├── node-exporter.yaml
├── prometheus
│?? ├── configmap.yaml
│?? ├── prometheus.deploy.yml
│?? ├── prometheus.svc.yml
│?? └── rbac-setup.yaml
└── README.md

二、部署yaml各个组件

kubectl命令tab补全

[root@k8s-master ~]# yum install -y bash-completion
[root@k8s-master ~]# source <(kubectl completion bash)

2.1 node-exporter.yaml

[root@k8s-master k8s-prometheus-grafana-master]# kubectl apply -f node-exporter.yaml 
daemonset.apps/node-exporter created
service/node-exporter created

#因为只有一个节点,这里如果有多个节点,节点数=node-exporterPod数
[root@k8s-master k8s-prometheus-grafana-master]# kubectl get pod -A | grep node-exporter
kube-system    node-exporter-kpdxh                  0/1     ContainerCreating      0          28s
[root@k8s-master k8s-prometheus-grafana-master]# kubectl get daemonset -A | grep exporter
kube-system    node-exporter     1         1         1       1            1           <none>                   2m43s
[root@k8s-master k8s-prometheus-grafana-master]# kubectl get service -A | grep exporter
kube-system   node-exporter   NodePort    10.96.73.86   <none>        9100:31672/TCP           2m59s

2.2 Prometheus

[root@k8s-master prometheus]# pwd
/opt/k8s-prometheus-grafana-master/prometheus
[root@k8s-master prometheus]# ls
configmap.yaml  prometheus.deploy.yml  prometheus.svc.yml  rbac-setup.yaml

按照顺序 rbac-setup.yaml configmap.yaml prometheus.deploy.yml prometheus.svc.yml ,yaml、yml文件没区别,不用在意。

[root@k8s-master prometheus]# kubectl apply -f rbac-setup.yaml
clusterrole.rbac.authorization.k8s.io/prometheus created
serviceaccount/prometheus created
clusterrolebinding.rbac.authorization.k8s.io/prometheus created

[root@k8s-master prometheus]# kubectl apply -f configmap.yaml
configmap/prometheus-config created

[root@k8s-master prometheus]# kubectl apply -f prometheus.deploy.yml
deployment.apps/prometheus created

[root@k8s-master prometheus]# kubectl apply -f prometheus.svc.yml
service/prometheus created

2.3 grafana

[root@k8s-master grafana]# pwd
/opt/k8s-prometheus-grafana-master/grafana
[root@k8s-master grafana]# ls
grafana-deploy.yaml  grafana-ing.yaml  grafana-svc.yaml

按照顺序安装 grafana-deploy.yaml grafana-svc.yaml grafana-ing.yaml

[root@k8s-master grafana]# kubectl apply -f grafana-deploy.yaml
deployment.apps/grafana-core created

[root@k8s-master grafana]# kubectl apply -f grafana-svc.yaml
service/grafana created

[root@k8s-master grafana]# kubectl apply -f grafana-ing.yaml
ingress.extensions/grafana created

检查三个pod(node-exporter可能有多个)

[root@k8s-master grafana]# kubectl get pod -A | grep node-exporter
kube-system    node-exporter-kpdxh                  1/1     Running                0          13m

[root@k8s-master grafana]# kubectl get pod -A | grep prometheus
kube-system    prometheus-7486bf7f4b-xb4t8          1/1     Running                0          6m21s

[root@k8s-master grafana]# kubectl get pod -A | grep grafana
kube-system    grafana-core-664b68875b-fhjvt        1/1     Running                0          2m18s

检查服务service,三个svc类型均为NodePort

[root@k8s-master grafana]# kubectl get svc -A
NAMESPACE     NAME            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
default       kubernetes      ClusterIP   10.96.0.1       <none>        443/TCP                  7h17m
kube-system   grafana         NodePort    10.107.115.11   <none>        3000:31748/TCP           3m41s
kube-system   kube-dns        ClusterIP   10.96.0.10      <none>        53/UDP,53/TCP,9153/TCP   7h17m
kube-system   node-exporter   NodePort    10.96.73.86     <none>        9100:31672/TCP           15m
kube-system   prometheus      NodePort    10.111.178.83   <none>        9090:30003/TCP           7m57s

2.4访问测试

curl访问测试 

[root@k8s-master grafana]# curl 127.0.0.1:31672
<html lang="en">
......

#node-exporter收集到的数据
[root@k8s-master grafana]# curl 127.0.0.1:31672/metrics
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.

[root@k8s-master grafana]# curl 127.0.0.1:30003
<a href="/graph">Found</a>.

[root@k8s-master grafana]# curl 127.0.0.1:31748
<a href="/login">Found</a>.

 访问11.0.1.12:31672/metrics,node-exporter收集到的数据

 访问11.0.1.12:30003/graph

选择 "status"--"targets"

三、grafana初始化

访问11.0.1.12:31748/login

账号密码都是admin

3.1加载数据源

监听地址 10.111.178.83:9090,prometheus的service地址

[root@k8s-master grafana]# kubectl get svc -A | grep prometheus
kube-system   prometheus      NodePort    10.111.178.83   <none>        9090:30003/TCP           40m

3.2导入模板

模板编号315

选择数据源prometheus

 完成监控

四、helm方式部署

......(待更新)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/85227.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

记一次项目内存优化--内存泄漏

需求–内存泄漏优化&#xff0c;PSS有所下降&#xff0c; OOM率减少 主要是与某个版本作基准进行对比&#xff08;一般是最新版本的前一个版本作原数据&#xff09;&#xff0c;优化后&#xff0c;PSS有所下降&#xff0c;线上OOM率减少&#xff08;Bugly版本对比&#xff09;…

Unsafe upfileupload

文章目录 client checkMIME Typegetimagesize 文件上传功能在web应用系统很常见&#xff0c;比如很多网站注册的时候需要上传头像、上传附件等等。当用户点击上传按钮后&#xff0c;后台会对上传的文件进行判断 比如是否是指定的类型、后缀名、大小等等&#xff0c;然后将其按…

Php“牵手”淘宝商品SKU信息数据采集方法,淘宝API接口申请指南

淘宝天猫商品属性sku信息接口 API 是开放平台提供的一种 API 接口&#xff0c;它可以帮助开发者获取商品的详细信息&#xff0c;包括商品的标题、描述、图片&#xff0c;销量&#xff0c;sku信息等信息。在电商平台的开发中&#xff0c;商品属性接口API是非常常用的 API&#x…

JS中对象数组深拷贝方法

structuredClone() JavaScript 中提供了一个原生 API 来执行对象的深拷贝&#xff1a;structuredClone。它可以通过结构化克隆算法创建一个给定值的深拷贝&#xff0c;并且还可以传输原始值的可转移对象。 当对象中存在循环引用时&#xff0c;仍然可以通过 structuredClone()…

基本定时器

1.简介 1. 基本定时器 TIM6 和 TIM7 包含一个 16 位自动重载计数器 2. 可以专门用于驱动数模转换器 (DAC), 用于触发 DAC 的同步电路 3. 16 位自动重载递增计数器 4. 16 位可编程预分频器 5. 计数器溢出时, 会触发中断/DMA请求 从上往下看 1.开始RCC供给定时器的时钟 RCC_APB1…

通过Matlab编程分析微分方程、SS模型、TF模型、ZPK模型的关系

微分方程、SS模型、TF模型、ZPK模型的关系 一、Matlab编程 微分方程、SS模型、TF模型、ZPK模型的关系二、对系统输出进行微分计算三、对系统输出进行积分计算四、总结五、系统的零点与极点的物理意义参考 &#xff1a;[https://www.zhihu.com/question/22031360/answer/3073452…

【AGC】Publishing api怎么上传绿色认证审核材料

【问题描述】 华为应用市场会对绿色应用标上特有的绿色标识&#xff0c;代表其通过华为终端开放实验室DevEco云测平台的兼容性、稳定性、安全、功耗和性能的检测和认证&#xff0c;是应用高品质的象征。想要自己的应用认证为绿色应用就需要在发布应用时提供绿色认证审核材料&a…

数据结构之——(手撕)顺序表

本章会介绍的知识点如下图&#xff1a; 1&#xff1a; 顺序表的概念&#xff1a;顺序表是用一段物理地址连续的存储单元依次存储数据的线性结构&#xff0c;通常我们使用数组来表示&#xff0c;对数组进行增删查改。 顺序表的结构&#xff1a;逻辑结构与物理结构都是内存中一块…

【宝藏系列】一文讲透C语言数组与指针的关系

【宝藏系列】嵌入式 C 语言代码优化技巧【超详细版】 文章目录 【宝藏系列】嵌入式 C 语言代码优化技巧【超详细版】&#x1f468;‍&#x1f3eb;前言1️⃣指针1️⃣1️⃣指针的操作1️⃣2️⃣关于指针定义的争议1️⃣3️⃣对教材错误写法的小看法 2️⃣指针和数组的区别2️⃣…

lab5 lazy

文章目录 Eliminate allocation from sbrk()Lazy allocationtaskhints实现 Lazytests and Userteststaskhints实现 Eliminate allocation from sbrk() 第一个任务是去阻止sysproc.c中的sys_sbrk()函数真的分配内存&#xff0c;只需要增p->sz即可 一行代码注释即可 uint64…

pandas数据分析40——读取 excel 合并单元格的表头

案例背景 真的很容易疯....上班的单位的表格都是不同的人做的&#xff0c;所以就会出现各种合并单元格的情况&#xff0c;要知道我们用pandas读取数据最怕合并单元格了&#xff0c;因为没规律...可能前几列没合并&#xff0c;后面几列又合并了....而且pandas对于索引很严格&am…

VR数字工厂多元化展现,打造数字企业工厂名片

5G时代&#xff0c;各种营销都在走数字化的路子&#xff0c;VR数字工厂用VR赋能工厂数字升级&#xff0c;将企业环境、工厂生产、产品研发、质检运输等流程&#xff0c;无死角720度的展示在客户面前&#xff0c;不仅可以提升自身企业的实力&#xff0c;还可以提高客户的信任感。…

使用Pandas处理Excel文件

Excel工作表是非常本能和用户友好的&#xff0c;这使得它们非常适合操作大型数据集&#xff0c;即使是技术人员也不例外。如果您正在寻找学习使用Python在Excel文件中操作和自动化内容的地方&#xff0c;请不要再找了。你来对地方了。 在本文中&#xff0c;您将学习如何使用Pan…

超级计算机

超级计算机是一种高性能计算机&#xff0c;它能够以极高的速度执行大规模的计算任务。超级计算机通常由数千个甚至数百万个处理器组成&#xff0c;这些处理器能够同时处理大量的数据&#xff0c;从而实现高效的计算。超级计算机广泛应用于科学、工程、金融、天气预报等领域&…

5G与4G的RRC协议之异同

什么是无线资源控制&#xff08;RRC&#xff09;&#xff1f; 我们知道&#xff0c;在移动通信中&#xff0c;无线资源管理是非常重要的一个环节&#xff0c;首先介绍一下什么是无线资源控制&#xff08;RRC&#xff09;。 手机和网络通过无线信道相互通信&#xff0c;彼此交…

SpringBoot - 两种方式刷新配置信息

一、第一种方式 ​ConfigurationProperties​不能自动刷新&#xff0c;需要手动调用contextRefresher.refresh()方法来刷新配置。 import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component;Component…

C#学习....

1.基础 //引用命名空间using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;//项目名或者命名空间 namespace _01_MY_First_Demo {//Program类class Program{//程序的主入口或者Main函数static void Main(S…

前端开发怎么解决性能优化的问题? - 易智编译EaseEditing

前端性能优化是确保网站或应用在加载速度、响应性和用户体验等方面达到最佳状态的关键任务。以下是一些解决前端性能优化问题的方法&#xff1a; 压缩和合并代码&#xff1a; 压缩和合并CSS、JavaScript和HTML文件可以减少文件大小&#xff0c;加快加载速度。使用压缩工具&am…

分布式核心知识以及常见微服务框架

分布式中的远程调用 在微服务架构中&#xff0c;通常存在多个服务之间的远程调用的需求。远程调用通常包含两个部分&#xff1a;序列化和通信协议。常见的序列化协议包括json、xml、 hession、 protobuf、thrift、text、 bytes等&#xff0c;目前主流的远程调用技术有基于HTTP…

C语言编写图形界面

文章目录 环境使用库基础概念句柄 程序的入口创建窗口定义窗口类注册窗口类创建窗口 完整代码运行效果 环境 使用的是VSCode MinGW&#xff1b; 使用库 我们使用windows.h库来实现图形化界面。 头文件如下&#xff1a; #include <windows.h>windows.h是 Windows 操作…