因为已经搭建过prometheus+grafana,所以此次只在kubernetes中启用 node服务和prometheus服务;并且已经搭建过私有镜像源,所有采用的策略是私有镜像源的方式搭建。
在master可以进行安装部署 安装git,并下载相关yaml文件
git clone https://github.com/redhatxl/k8s-prometheus-grafana.git
复制代码
docker pull prom/node-exporter
docker pull prom/prometheus:v2.0.0
docker pull grafana/grafana:4.2.0(因为已经有节点安装了grafana,古此次装grafana服务了
[root@cs1 shellExecute]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
edp963/davinci v0.3.0-beta.6 37e2a99c771d 2 months ago 659MB
metabase/metabase latest 2b206aa106f1 2 months ago 295MB
192.168.100.14:5000/prom/node-exporter 1.0 e5a616e4b9cf 2 months ago 22.9MB
prom/node-exporter latest e5a616e4b9cf 2 months ago 22.9MB
registry latest f32a97de94e1 5 months ago 25.8MB
prom/prometheus v2.0.0 67141fa03496 21 months ago 80.2MB
grafana/grafana 4.2.0 8c4ef64b4ad1 2 years ago 278MB
[root@cs1 shellExecute]# docker tag 67141fa03496 192.168.100.14:5000/prom/prometheus:1.0
[root@cs1 shellExecute]# docker push 192.168.100.14:5000/prom/prometheus:1.0
The push refers to repository [192.168.100.14:5000/prom/prometheus]
5f70bf18a086: Pushed
cd121de2bc21: Pushed
98f3335bc35c: Pushed
fb340ee8adb7: Pushed
031d51969af8: Pushed
4225e9723f99: Pushed
e48519037ac3: Pushed
bb7510ff5b97: Pushed
1692ded805c8: Pushed
6a749002dd6a: Pushed
1.0: digest: sha256:61a663593875127a88291f2ee84b4ff459539271c05f380f595e544302b4112e size: 3845
同理tag node-exporter
需要修改配置文件node-exporter.yaml (如果你不是使用的私有镜像,不需要修改 )
kubectl create -f node-exporter.yaml
复制代码
kubectl create -f k8s-prometheus-grafana/prometheus/rbac-setup.yaml
以configmap的形式管理prometheus组件的配置文件
kubectl create -f k8s-prometheus-grafana/prometheus/configmap.yaml
修改配置文件prometheus.deploy.yml
kubectl create -f k8s-prometheus-grafana/prometheus/prometheus.svc.yml
http://192.168.100.26:31672/metrics
http://192.168.100.26:30003/graph
(一) Dashboard下载地址:
https://grafana.com/api/dashboards/315/revisions/3/download
导入选择数据源即可