使用helm快速安装 grafanaprometheus
系列文章目录
1、使用helm快速安装 grafana&prometheus
2、利用grafana&prometheus 快速配置 k8s & 主机监控
3、grafana&prometheus 快速配置报警规则及报警接收
文章目录
- 系列文章目录
- 前言
- 一、安装helm
- 一、安装应用
- 更改 grafana 服务暴露方式
- 查看grafana服务
- 后续工作
前言
如何快速安装监控grafana&prometheus
Prometheus是一个开源监控解决方案,用于收集和聚合指标作为时间序列数据,内置了PromQL,允许用户实时选择和汇聚时间序列数据。我们可以直接把它当作时序数据库来用。
Grafana 是与Prometheus配合的可视化程序,它提供了强大和优雅的方式去创建、共享、浏览数据。利用它可以创建 不同metric数据源的优美 Dashboard,官方提供了多种成型Dashboard模板供你选择。
Helm可以说是的k8s集群的yum,javascript领域的npm,java领域的maven,golang领域的go mod,今天给大家介绍如何利用helm快速安装 grafana&prometheus。
一、安装helm
前置前提你的机器必须安装了k8s集群,就相当于你想安装maven你必须要先安装jvm/jdk一样。
[root@master ~]# wget https://get.helm.sh/helm-v3.4.0-rc.1-linux-amd64.tar.gz
[root@master ~]# tar xf helm-v3.4.0-rc.1-linux-amd64.tar.gz
[root@master ~]# mv linux-amd64/helm /usr/local/bin/
验证
[root@master ~]# helm help
The Kubernetes package manager
Common actions for Helm:
- helm search: search for charts
- helm pull: download a chart to your local directory to view
- helm install: upload the chart to Kubernetes
添加常用仓库
添加新的仓库地址
[root@master ~]# helm repo add stable https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
[root@master ~]# helm repo add ali-incubator https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts-incubator/
[root@master ~]# helm repo add apphub https://apphub.aliyuncs.com/
更新仓库
[root@master ~]# helm repo update
查看在存储库中可用的所有 Helm charts
[root@master ~]# helm search repo
一、安装应用
执行prometheus安装
helm install my apphub/prometheus
安装明细记录,记录下面后面需要使用:
NAME: my
LAST DEPLOYED: Sat Jun 25 09:17:18 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The Prometheus server can be accessed via port 80 on the following DNS name from within your cluster:
my-prometheus-server.default.svc.cluster.localGet the Prometheus server URL by running these commands in the same shell:export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")kubectl --namespace default port-forward $POD_NAME 9090The Prometheus alertmanager can be accessed via port 80 on the following DNS name from within your cluster:
my-prometheus-alertmanager.default.svc.cluster.localGet the Alertmanager URL by running these commands in the same shell:export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=alertmanager" -o jsonpath="{.items[0].metadata.name}")kubectl --namespace default port-forward $POD_NAME 9093
#################################################################################
###### WARNING: Pod Security Policy has been moved to a global property. #####
###### use .Values.podSecurityPolicy.enabled with pod-based #####
###### annotations #####
###### (e.g. .Values.nodeExporter.podSecurityPolicy.annotations) #####
#################################################################################The Prometheus PushGateway can be accessed via port 9091 on the following DNS name from within your cluster:
my-prometheus-pushgateway.default.svc.cluster.localGet the PushGateway URL by running these commands in the same shell:export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=pushgateway" -o jsonpath="{.items[0].metadata.name}")kubectl --namespace default port-forward $POD_NAME 9091For more information on running Prometheus, visit:
https://prometheus.io/
helm install mygrafana apphub/grafana
NAME: mygrafana
LAST DEPLOYED: Sat Jun 25 09:20:10 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get your 'admin' user password by running:kubectl get secret --namespace default mygrafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo2. The Grafana server can be accessed via port 80 on the following DNS name from within your cluster:mygrafana.default.svc.cluster.localGet the Grafana URL to visit by running these commands in the same shell:export POD_NAME=$(kubectl get pods --namespace default -l "app=grafana,release=mygrafana" -o jsonpath="{.items[0].metadata.name}")kubectl --namespace default port-forward $POD_NAME 30003. Login with the password from step 1 and the username: admin
#################################################################################
###### WARNING: Persistence is disabled!!! You will lose your data when #####
###### the Grafana pod is terminated. #####
#################################################################################
更改 grafana 服务暴露方式
导出yaml配置文件
kubectl get service mygrafana -o yaml > mygrafana.yaml
更改服务暴露方式,更改将CluserIP更改为NodePort,并且指定端口号为: 31036
apiVersion: v1
kind: Service
metadata:annotations:meta.helm.sh/release-name: mygrafanameta.helm.sh/release-namespace: defaultcreationTimestamp: "2022-06-25T01:20:11Z"labels:app: grafanaapp.kubernetes.io/managed-by: Helmchart: grafana-4.6.3heritage: Helmrelease: mygrafananame: mygrafananamespace: defaultresourceVersion: "5807668"uid: e8fd4ab7-faf0-4328-ad5b-fa5c96820b25
spec:clusterIP: 10.233.60.69clusterIPs:- 10.233.60.69ipFamilies:- IPv4ipFamilyPolicy: SingleStackports:- name: serviceport: 80protocol: TCPtargetPort: 3000nodePort: 31036selector:app: grafanarelease: mygrafanasessionAffinity: Nonetype: NodePort
status:loadBalancer: {}
应用配置文件
kubectl apply -f mygrafana.yaml
service/mygrafana configured
查看grafana服务
查看登陆密码:
kubectl get secret --namespace default mygrafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
JV3efD8S7xQdjhTkPJTtbefoJ5nl4L6mY2wlt8IS
登陆访问:
http://127.0.0.1:31036
添加访问数据源:Prometheus
添加prometheus-3数据源
root@master:~$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.233.0.1 <none> 443/TCP 19d
my-prometheus-alertmanager ClusterIP 10.233.54.95 <none> 80/TCP 68m
my-prometheus-kube-state-metrics ClusterIP None <none> 80/TCP,81/TCP 68m
my-prometheus-node-exporter ClusterIP None <none> 9100/TCP 68m
my-prometheus-pushgateway ClusterIP 10.233.33.142 <none> 9091/TCP 68m
my-prometheus-server NodePort 10.233.42.105 <none> 80:30241/TCP 68m
mygrafana NodePort 10.233.60.69 <none> 80:31036/TCP 65m
my-prometheus-server对应的ClusterIP+端口80就是对应URL地址
配置dashborad 2.0
查看结果:
后续工作
安装完毕服务了后续我们要做的有哪些呢?
1、k8s 服务面板设置
1、node服务监控
2、pod容器监控
3、其他服务监控
使用helm快速安装 grafanaprometheus相关推荐
- 虚拟机linux 8.04汉化,在虚拟机中快速安装 Ubuntu 18.04
1.准备工作:安装前的准备 2.快速安装及认识界面:安装并认识 Ubuntu,知道最常规操作 3.系统设置:添加中文支持,设置系统时区 4.安装常用软件:选择国内的镜像服务器,安装常用软件 1.准备工 ...
- 在VMware上快速安装win 2003
在VMware 上安装win 2003 操作系统相信大家都会,我也会,呵呵 我刚才好像说的是废话啊!我所说的快速安装,几乎可以说是无人值守安装!那速度真快啊!呵呵其实呢!我也是在一个偶然的机会发现的, ...
- (总结)CentOS 6.x使用yum快速安装Apache+PHP+Tomcat(JSP)+MySQL
(总结)CentOS 6.x使用yum快速安装Apache+PHP+Tomcat(JSP)+MySQL PS:这个是懒人yum快速安装法,用于开发和测试环境很方便,用于没有特殊要求的生产环境也可以.特 ...
- APC UPS网络管理卡 (AP9606/9617/9618/9619)的快速安装及配置指南
APC UPS网络管理卡 (AP9606/9617/9618/9619)的快速安装及配置指南 本文说明如何配置APC UPS网络管理卡所需的基本网络参数 在正确使用网络管理卡之前,必须对其基本参数进行 ...
- Ceph分布式存储实战1.4 Ceph快速安装
1.4 Ceph快速安装 在Ceph官网上提供了两种安装方式:快速安装和手动安装.快速安装采用Ceph-Deploy工具来部署:手动安装采用官方教程一步一步来安装部署Ceph集群,过于烦琐但有助于加深 ...
- SQL Server 2008 R2中文版快速安装
SQL Server 2008 R2中文版快速安装 1 实验环境 1)域: 域名为fengxja.com: 域功能级别和林功能级别为Windows server 2003模式. 2)DC01服务器: ...
- c++入门代码_Golang Gin 实战(一)| 快速安装入门
Golang Gin 实战(一)| 快速安装入门 Gin 是一个非常优秀的Golang Web Framework,它不光API友好,性能也非常高,并且设计简洁,便于入门.所以它(Gin)非常受欢迎, ...
- 在虚拟机中快速安装 Ubuntu 18.04
2019独角兽企业重金招聘Python工程师标准>>> 原文链接https://mp.weixin.qq.com/s/Mjz_KNnhPeBaXxHB_G729Q 内容列表 1.准备 ...
- 在Ubuntu中用anaconda快速安装opencv3
原文: http://blog.csdn.net/isuccess88/article/details/73546835 在Ubuntu中用anaconda快速安装opencv3 我的系统环境: Ub ...
最新文章
- jquery validate使用
- 如何使用SAP零售系统中的LISTING?
- 常考数据结构与算法:单链表的排序
- ios开发 UITableView with xib 以及自定义TableViewCell
- Git图形化管理工具
- Eclipse Add generated serial version ID报错解决方案
- itcast-ssh-crm实践
- maya扇子动画_maya怎么制作一个万箭齐发的效果?
- 盘点下常用的接口测试工具,有几个你肯定没用过
- ds查找—二叉树平衡因子_《大话数据结构》C++实现二叉平衡树的建立
- vue动态改变css样式
- 单相智能电表(Modbus协议)
- 物联卡的测试期、沉默期、计费期你都知道吗
- 用c语言绘制小猫图案,【科研猫·R】R语言从入门到精通:Day8
- Python 蓝凌OA任意文件读取批量扫描 poc编写
- 这应该是最全面的MySQL知识点总结啦
- uni-App快速开发一个安卓应用
- 软件构造学习笔记ATD
- 网络空间安全导论期末复习题
- Duplicate named routes definition
热门文章
- yjk的波库在哪里_[稀有资源]盈建科YJK地震波文件
- 关于MRP的几个概念
- cmsplus实战之仿[我扫网]之十二:打包网站及数据库并上传到服务器调试
- 小米上市市值逼近京东,雷军成为全球最有钱的100人之一!
- jvisualvm命令(Java Virtual Machine Monitoring, Troubleshooting, and Profiling Tool)
- 介数中心度(Betweenness Centrality)
- .NET开发常用工具大汇总
- oppo和海康嵌入式软件工程师面经总结
- crossover linux 中文乱码,在Ubuntu Kylin下用Crossover安装东方财富出现内容乱码的处理...
- 即时配送-小程序使用