k8s 添加 Prometheus+Grafana的监控
#安装git,下载yaml
git clone https://github.com/zhanshen-liu/k8s-prometheus-grafana
#安装node-exporter
kubectl create -f node-exporter.yaml
#安装prometheus组件
kubectl create -f k8s-prometheus-grafana/prometheus/rbac-setup.yaml
kubectl create -f k8s-prometheus-grafana/prometheus/configmap.yaml
kubectl create -f k8s-prometheus-grafana/prometheus/prometheus.deploy.yml
kubectl create -f k8s-prometheus-grafana/prometheus/prometheus.svc.yml
#安装 grafana 组件
kubectl create -f k8s-prometheus-grafana/grafana/grafana-deploy.yaml
kubectl create -f k8s-prometheus-grafana/grafana/grafana-svc.yaml
kubectl create -f k8s-prometheus-grafana/grafana/grafana-ing.yaml
1、查看组件服务的映射端口
访问
![](https://img.haomeiwen.com/i16900817/1ff55414fc5f5589.png)
2、prometheus http://ip:300032、grafanahttp://ip:300032、grafanahttp://ip:31112 (默认用户密码 admin admin)
3、配置grafana 数据源为prometheus
![](https://img.haomeiwen.com/i16900817/f7c88aca1d9c1c7f.png)
4、导入dashboard面板
![](https://img.haomeiwen.com/i16900817/f885fddb532f15ff.png)
![](https://img.haomeiwen.com/i16900817/57c0c67aa9888693.png)
5、查看grafana 监控图标
![](https://img.haomeiwen.com/i16900817/50c40324f00a9c5b.png)