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

下载
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: grafana
app.kubernetes.io/name: grafana
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 8.1.3
name: grafana
namespace: monitoring
spec:
type: NodePort
ports:
- name: http
port: 3000
targetPort: http
nodePort: 31100
selector:
app.kubernetes.io/component: grafana
app.kubernetes.io/name: grafana
app.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: prometheus
app.kubernetes.io/name: prometheus
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 2.30.0
prometheus: k8s
name: prometheus-k8s
namespace: monitoring
spec:
type: NodePort
ports:
- name: web
port: 9090
targetPort: web
nodePort: 31200
- name: reloader-web
port: 8080
targetPort: reloader-web
nodePort: 31300
selector:
app: prometheus
app.kubernetes.io/component: prometheus
app.kubernetes.io/name: prometheus
app.kubernetes.io/part-of: kube-prometheus
prometheus: k8s
sessionAffinity: 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: main
app.kubernetes.io/component: alert-router
app.kubernetes.io/name: alertmanager
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.23.0
name: alertmanager-main
namespace: monitoring
spec:
type: NodePort
ports:
- name: web
port: 9093
targetPort: web
nodePort: 31400
- name: reloader-web
port: 8080
targetPort: reloader-web
nodePort: 31500
selector:
alertmanager: main
app: alertmanager
app.kubernetes.io/component: alert-router
app.kubernetes.io/name: alertmanager
app.kubernetes.io/part-of: kube-prometheus
sessionAffinity: 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

访问 Grafana
Visit Grafana
http://192.168.1.10:31100/

访问报警平台 AlertManager
Visit the alert platform AlertManager
http://192.168.1.10:31400/#/status


kubernetes 安装 Prometheus + Grafana的更多相关文章
- [转帖]安装prometheus+grafana监控mysql redis kubernetes等
安装prometheus+grafana监控mysql redis kubernetes等 https://www.cnblogs.com/sfnz/p/6566951.html plug 的模式进行 ...
- 安装prometheus+grafana监控mysql redis kubernetes等
1.prometheus安装 wget https://github.com/prometheus/prometheus/releases/download/v1.5.2/prometheus-1.5 ...
- kubernetes(k8s) Prometheus+grafana监控告警安装部署
主机数据收集 主机数据的采集是集群监控的基础:外部模块收集各个主机采集到的数据分析就能对整个集群完成监控和告警等功能.一般主机数据采集和对外提供数据使用cAdvisor 和node-exporter等 ...
- Kubernetes使用prometheus+grafana做一个简单的监控方案
前言 本文介绍在k8s集群中使用node-exporter.prometheus.grafana对集群进行监控.其实现原理有点类似ELK.EFK组合.node-exporter组件负责收集节点上的me ...
- Kubernetes部署Prometheus+Grafana(非存储持久化方式部署)
1.在master节点处新建一个文件夹,用于保存下载prometheus+granfana的yaml文件 mkdir /root/prometheus cd /root/prometheus git ...
- 使用 Prometheus + Grafana 对 Kubernetes 进行性能监控的实践
1 什么是 Kubernetes? Kubernetes 是 Google 开源的容器集群管理系统,其管理操作包括部署,调度和节点集群间扩展等. 如下图所示为目前 Kubernetes 的架构图,由 ...
- Kubernetes+Prometheus+Grafana部署笔记
一.基础概念 1.1 基础概念 Kubernetes(通常写成“k8s”)Kubernetes是Google开源的容器集群管理系统.其设计目标是在主机集群之间提供一个能够自动化部署.可拓展.应用容器可 ...
- [转帖]Prometheus+Grafana监控Kubernetes
原博客的位置: https://blog.csdn.net/shenhonglei1234/article/details/80503353 感谢原作者 这里记录一下自己试验过程中遇到的问题: . 自 ...
- Rancher2.x 一键式部署 Prometheus + Grafana 监控 Kubernetes 集群
目录 1.Prometheus & Grafana 介绍 2.环境.软件准备 3.Rancher 2.x 应用商店 4.一键式部署 Prometheus 5.验证 Prometheus + G ...
- 附014.Kubernetes Prometheus+Grafana+EFK+Kibana+Glusterfs整合解决方案
一 glusterfs存储集群部署 注意:以下为简略步骤,详情参考<附009.Kubernetes永久存储之GlusterFS独立部署>. 1.1 架构示意 略 1.2 相关规划 主机 I ...
随机推荐
- PLC入门笔记8
梯形图基础电路 起保停电路 多点起保停电路 互锁控制电路 周期闪烁电路 这应该是等价的!! 定时器的接力电路 同 延时接通,延时断开电路 同 保持信号变脉冲信号电路 定时器TON 接通延时变断开延时电 ...
- 实验一 Linux系统与应用课程准备
項目 內容 这个作业属于哪个课程 班级课程主要链接 这个作业的要求在哪里 作业要求链接 学号-姓名 15043109-吴小怀 作业学习目标 学会在博客园社区中学习Linux的使用技巧,熟练使用Typo ...
- 02题解-洛谷 P2395 BBCode转换Markdown 题解
洛谷 P2395 BBCode转换Markdown 题解 题目传送门: here. 一道毒瘤的大模拟,给了你一部分的 BBCode 和 Markdown 语法,叫你转换.如下表: BBCode Mar ...
- 划分数据集时出现PermissionError: [Errno 13] Permission denied:
PermissionError: [Errno 13] Permission denied: [errno 13]权限被拒绝 错误的原因可能是文件找不到,或者被占用,或者无权限访问,或者打开的不是文件 ...
- scanf()函数的详解以及使用时需要注意的一些细节-C语言基础
这篇文章要探讨的是"scanf()函数的详解以及使用时需要注意的一些细节".涉及scanf()函数的应用和需要注意的问题.属于C语言基础篇(持续更新). scanf()(函数原型: ...
- MySQL数据库sql_mode导致varchar字段超过长度被截断插入
django数据库设置sql_mode MySQL的sql_mode解析与设置 mysql中sql_mode的修改 sql_mode:它定义了MySQL应该支持的sql语法,对数据的校验等等. 问题 ...
- MySQL使用bin-log将数据恢复到某个时间点
binlog的三种模式 statement:记录每一条修改数据的sql row:保存哪条记录被修改 mixed:兼顾前两者的优点. # 查看binlog有没有开启 SHOW VARIABLES LIK ...
- CentOS7 进入修复模式的办法
有时候配置Centos文件修改错误会导致系统无法登录,可以通过修复模式进行单用户运行模式,进行修复. 具体操作如下: 1.重启服务器,在选择内核界面使用上下箭头移动 2.选择内核并按"e&q ...
- ES搜索高亮分词排序聚合搜索
分词高亮搜索代码 List<A> list = new ArrayList<>(); //设置高亮显示 HighlightBuilder highlightBuilder = ...
- awk sub string
cat TFY1C.txt|awk '{print $0"\t"substr($4,1,4)}'> TFY1CRID.tx 1--从那位开始 4--多长