kubernetes 安装 Prometheus + Grafana

kubernetes 安装 Prometheus + Grafana

kubernetes install Prometheus + Grafana

官网

Official website

https://prometheus.io/

GitHub

GitHub

https://github.com/coreos/kube-prometheus

组件说明

Component description

MetricServer:是kubernetes集群资源使用情况的聚合器,收集数据给kubernetes集群内使用,如 kubectl,hpa,scheduler等。

PrometheusOperator:是一个系统监测和警报工具箱,用来存储监控数据。

NodeExporter:用于各node的关键度量指标状态数据。

KubeStateMetrics:收集kubernetes集群内资源对象数 据,制定告警规则。

Prometheus:采用pull方式收集apiserver,scheduler,controller-manager,kubelet组件数 据,通过http协议传输。

Grafana:是可视化数据统计和监控平台。

MetricServer: It is an aggregator of the resource usage of the kubernetes cluster, collecting data for use in the kubernetes cluster, such as kubectl, hpa, scheduler, etc.

PrometheusOperator: is a system monitoring and alerting toolbox used to store monitoring data.

NodeExporter: Used for the key metric status data of each node.

KubeStateMetrics: Collect resource object data in the kubernetes cluster and formulate alarm rules.

Prometheus: collect data from apiserver, scheduler, controller-manager, and kubelet components in a pull mode, and transmit it through the http protocol.

Grafana: It is a platform for visual data statistics and monitoring.

安装

Install

配置Google上网环境下的docker,docker会去外网进行下载部分镜像

Configure docker in Google's Internet environment, docker will go to the external network to download part of the image

sudo mkdir -p /etc/systemd/system/docker.service.d
sudo touch /etc/systemd/system/docker.service.d/proxy.conf
[root@k8s-master-node1 ~]# cat /etc/systemd/system/docker.service.d/proxy.conf
[Service]
Environment="HTTP_PROXY=http://192.168.1.6:7890/" 
Environment="HTTPS_PROXY=http://192.168.1.6:7890/" 
Environment="NO_PROXY=localhost,127.0.0.1,.example.com"

dockerd代理的修改比较特殊,它实际上是改systemd的配置,因此需要重载systemd并重启dockerd才能生效。

The modification of the dockerd agent is quite special. It actually changes the configuration of systemd, so systemd needs to be reloaded and dockerd restarted to take effect.

sudo systemctl daemon-reload
sudo systemctl restart docker

b326a7883a5fb4873853511809c04955.png

下载

download

[root@k8s-master-node1 ~]# git clone https://github.com/coreos/kube-prometheus.git
Cloning into 'kube-prometheus'...
remote: Enumerating objects: 13409, done.
remote: Counting objects: 100% (1908/1908), done.
remote: Compressing objects: 100% (801/801), done.
remote: Total 13409 (delta 1184), reused 1526 (delta 947), pack-reused 11501
Receiving objects: 100% (13409/13409), 6.65 MiB | 5.21 MiB/s, done.
Resolving deltas: 100% (8313/8313), done.
[root@k8s-master-node1 ~]# 
[root@k8s-master-node1 ~]# cd kube-prometheus/manifests
[root@k8s-master-node1 ~/kube-prometheus/manifests]#

修改 grafana-service.yaml 文件,使用 nodepode 方式访问 grafana:

Modify the grafana-service.yaml file and use nodepode to access grafana:

[root@k8s-master-node1 ~/kube-prometheus/manifests]# cat grafana-service.yaml
apiVersion: v1
kind: Service
metadata:labels:app.kubernetes.io/component: grafanaapp.kubernetes.io/name: grafanaapp.kubernetes.io/part-of: kube-prometheusapp.kubernetes.io/version: 8.1.3name: grafananamespace: monitoring
spec:type: NodePortports:- name: httpport: 3000targetPort: httpnodePort: 31100selector:app.kubernetes.io/component: grafanaapp.kubernetes.io/name: grafanaapp.kubernetes.io/part-of: kube-prometheus

修改 prometheus-service.yaml,改为 nodepode:

Modify prometheus-service.yaml to nodepode:

[root@k8s-master-node1 ~/kube-prometheus/manifests]# cat prometheus-service.yaml
apiVersion: v1
kind: Service
metadata:labels:app.kubernetes.io/component: prometheusapp.kubernetes.io/name: prometheusapp.kubernetes.io/part-of: kube-prometheusapp.kubernetes.io/version: 2.30.0prometheus: k8sname: prometheus-k8snamespace: monitoring
spec:type: NodePortports:- name: webport: 9090targetPort: webnodePort: 31200- name: reloader-webport: 8080targetPort: reloader-webnodePort: 31300selector:app: prometheusapp.kubernetes.io/component: prometheusapp.kubernetes.io/name: prometheusapp.kubernetes.io/part-of: kube-prometheusprometheus: k8ssessionAffinity: ClientIP

修改 alertmanager-service.yaml,改为 nodepode

Modify alertmanager-service.yaml to nodepode

[root@k8s-master-node1 ~/kube-prometheus/manifests]# cat alertmanager-service.yaml 
apiVersion: v1
kind: Service
metadata:labels:alertmanager: mainapp.kubernetes.io/component: alert-routerapp.kubernetes.io/name: alertmanagerapp.kubernetes.io/part-of: kube-prometheusapp.kubernetes.io/version: 0.23.0name: alertmanager-mainnamespace: monitoring
spec:type: NodePortports:- name: webport: 9093targetPort: webnodePort: 31400- name: reloader-webport: 8080targetPort: reloader-webnodePort: 31500selector:alertmanager: mainapp: alertmanagerapp.kubernetes.io/component: alert-routerapp.kubernetes.io/name: alertmanagerapp.kubernetes.io/part-of: kube-prometheussessionAffinity: ClientIP
[root@k8s-master-node1 ~/kube-prometheus/manifests]#

创建名称空间和CRD

Create namespace and CRD

[root@k8s-master-node1 ~/kube-prometheus]# kubectl create -f /root/kube-prometheus/manifests/setup
namespace/monitoring created
customresourcedefinition.apiextensions.k8s.io/alertmanagerconfigs.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/alertmanagers.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/podmonitors.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/probes.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/prometheuses.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/prometheusrules.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/servicemonitors.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/thanosrulers.monitoring.coreos.com created
clusterrole.rbac.authorization.k8s.io/prometheus-operator created
clusterrolebinding.rbac.authorization.k8s.io/prometheus-operator created
deployment.apps/prometheus-operator created
service/prometheus-operator created
serviceaccount/prometheus-operator created

等待资源可用后,安装

After waiting for resources to be available, install

[root@k8s-master-node1 ~/kube-prometheus]# 
[root@k8s-master-node1 ~/kube-prometheus]# 
[root@k8s-master-node1 ~/kube-prometheus]# kubectl create -f /root/kube-prometheus/manifests/---略---[root@k8s-master-node1 ~/kube-prometheus]#

访问 Prometheus

Visit Prometheus

http://192.168.1.10:31200/targets

ce3579a8549c5a57f610137b3938c936.png

访问 Grafana

Visit Grafana

http://192.168.1.10:31100/

658089eab1cef9781312b66f2fc03180.png

访问报警平台 AlertManager

Visit the alert platform AlertManager

http://192.168.1.10:31400/#/status

90e5bc2941447d022f9c9eb0e57005a4.png

30be913773cbbc84c1112a9969d35a65.png

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

如若内容造成侵权/违法违规/事实不符,请联系瞎胡闹网进行投诉反馈,一经查实,立即删除!

相关文章

Maya《UV》

Maya 《UV》 1.建模编辑器 2. U轴V轴,UV工具包 3.工具》显示UV工具包 4.赋予物体贴图 1)材质 2)贴图 双击材质球,点击颜色后面的棋盘格,在弹出的窗口中选择文件,将需要的贴图赋予材质球 按下6进行显示贴…

WADO-URI,WADO-RS

可以关注技术大牛博客https://blog.csdn.net/zssureqh WADO-URI accept:请求中的accept表明客户端(通常是浏览器)自身能够支持的从服务器返回的数据类型,例如上图中支持image/webp,image/,/*;q0.8表示图片的质量 accept-encodi…

OWA TOP10

1.SQL注入 1.1.解释 将一些包含指令的数据传入给解释器,如SQL注入 1.2.防范措施 对特殊字符进行转义 1.3.演示 package mainimport ("github.com/gin-gonic/gin""net/http" ) import "database/sql" import _ "github.com…

weakauras教程_简单的WeakAuras2教程 基础功能设置指南(2)

WeakAuras2教程之冷却设置 这样,不灭决心的冷却图标我们也就做出来了! 然后我们要做的事是让他们重合在一个位置(鼠标不准的话可以在图示里面的XY偏移调,两个数字都一样就行。 重合后我们关掉插件,使用技能不灭决心,&a…

weka介绍与安装

一、weka介绍 WEKA的全名是怀卡托智能分析环境(Waikato Environment for Knowledge Analysis),同时weka也是新西兰的一种鸟名,而WEKA的主要开发者来自新西兰。WEKA作为一个公开的数据挖掘工作平台,集合了大量能承担数…

海睿思分享 | 摆脱数据质量低下困扰,这个方法简单有效!

2019年五月,某企业数据服务平台推送了运营花呗的蚂蚁小微小额贷款有限公司进入清算程序。 究其原因,该数据服务平台抓取了不真实且不完整的数据,导致生成的数据质量低,信息不真实、存在法律合规风险等情况。 由于支付宝和花呗的…

从0到1实现IOC

一、什么是 IOC 我们先来看看spring官网对IOC的定义: IoC is also known as dependency injection (DI). It is a process whereby objects define their dependencies, that is, the other objects they work with, only through constructor arguments, argumen…

23 种设计模式的通俗解释

咱也来一篇java相关的哦 01 工厂方法 追 MM 少不了请吃饭了,麦当劳的鸡翅和肯德基的鸡翅都是 MM 爱吃的东西,虽然口味有所不同,但不管你带 MM 去麦当劳或肯德基,只管向服务员说「来四个鸡翅」就行了。麦当劳和肯德基就是生产鸡翅…

23 种设计模式的通俗解释,秒懂

01 工厂方法 追 MM 少不了请吃饭了,麦当劳的鸡翅和肯德基的鸡翅都是 MM 爱吃的东西,虽然口味有所不同,但不管你带 MM 去麦当劳或肯德基,只管向服务员说「来四个鸡翅」就行了。麦当劳和肯德基就是生产鸡翅的 Factory 工厂模式&…

一篇读懂设计模式

概述 软件设计模式(Software Design Pattern),又称设计模式,是一套被反复使用、多 数人知晓的、经过分类编目的、代码设计经验的总结。它描述了在软件设计过程中的一些不 断重复发生的问题,以及该问题的解决方案。也就…

【计算机专业漫谈】【计算机系统基础学习笔记】W1-计算机系统概述

利用空档期时间学习一下计算机系统基础,以前对这些知识只停留在应试层面,今天终于能详细理解一下了。参考课程为南京大学袁春风老师的计算机系统基础MOOC,参考书籍也是袁老师的教材,这是我的听课自查资料整理后的笔记,…

开源预告:NAS邂逅WiFi6+

开源预告:NAS邂逅WiFi6 1 似曾相识的场景2 迷你PT仓库原型机3 开源内容 开源地址:https://github.com/sazczmh/pi-wifi6-nas 1 似曾相识的场景 不知道关注我的小伙伴们有没有如下体验。 学习工作: 为了便于PDF文档资料移动查阅&#xff0c…

电脑数据隐藏原因有哪些?电脑里隐藏的数据怎么恢复

电脑里隐藏的数据怎么恢复?电脑中的数据很容易被隐藏,这时候很多人可能会感到焦急和无助。不过不用担心,本文将为大家介绍三种方法,让你轻松找回被隐藏的数据! ※电脑数据隐藏原因有哪些 电脑数据可能会隐藏&#xf…

GOF23

 * GOFgang of four,指《设计模式》一书的四位作者; 创建型模式 1、ABSTRACT FACTORY 抽象工厂模式: √ 客户类和工厂类分开。消费者任何时候需要某套产品集合时,只需向抽象工厂请求即可。抽…

qq2012beta2java_QQ2012Beta2正式版官方发布下载 QQ群支持全群语音

期待已久的QQ2012 Beta2携带重磅功能今日倾情推出,引爆初夏热情!巧遇卡汇聚缘分引爆惊喜,视频秀随时直播精彩生活,QQ群可全群语音快乐畅谈! 群成员群消息提醒更贴心!更多惊喜撬动你的娱乐神经,这…

23 种设计模式的有趣见解

创建型模式1、FACTORY—追MM少不了请吃饭了,麦当劳的鸡翅和肯德基的鸡翅都是MM爱吃的东西,虽然口味有所不同,但不管你带MM去麦当劳或肯德基,只管向服务员说“来四个鸡翅”就行了。麦当劳和肯德基就是生产鸡翅的Factory 工厂…

海睿思分享 | 低代码开发直面行业变革:革新,创新?

软件体系结构从单体集群服务时期,历经领域驱动设计、微服务架构等阶段,软件产品的开发过程的变革正在潜移默化地进行。 在软件逻辑架构设计、物理架构设计、构建与部署这一系列化的过程中,存在可缩减的设计与开发成本,曾经看似不可…

stable diffusion中的u net

Stable Diffusion 包含几个核心的组件: 一个文本编码器(在 Stable Diffusion 中使用 CLIP 的 ViT-L/14 的文本编码器),用于将用户输入的 Prompt 文本转化成 text embedding;一个 Image Auto Encoder-Decoder&#xff…

Selenium自动化之弹窗处理

1.前言 我们在使用Selenium做Web自动化测试时,页面经常出现弹窗,如果不处理后续的测试脚本就无法正常运行,今天我们就带大家一起来学习如何处理Web页面上的弹窗。 2.Web页面弹窗的分类 弹窗通常有3种:Alert类型弹框、Confirm类…

leetcode98. 验证二叉搜索树(java)

验证二叉搜索树 leetcode98. 验证二叉搜索树题目描述 递归法解题思路代码演示 中序遍历解法解题思路代码演示 二叉树专题 leetcode98. 验证二叉搜索树 leetcode 98.验证二叉搜索树 来源:力扣(LeetCode) 链接:https://leetcode.cn/…