- 安装git
- yum install git -y
- 登录github,查看kube-prometheus项目
- https://github.com/prometheus-operator/kube-prometheus
- 查看kubenetes对应版本
- 拉取对应的kube-prometheus版本
- git clone https://github.com/prometheus-operator/kube-prometheus.git -b release-0.7
- cd /kube-prometheus/manifests/setup
- kubectl create -f .
- cd /kube-prometheus/manifests
- kubectl create -f . 修改三个文件,改为NodPort
- prometheus-service.yaml
- alertmanager-service.yaml
- grafana-service.yaml
- 查看是否生效:kubectl get svc -n monitoring
- 有pod节点拉取镜像失败时:ImagePullBackOff
- kubectl describe pod -n monitoring
- 查看拉取镜像
- 修改 vim kubeStateMetrics-deployment.yaml
- image修改为:从https://hub.docker.com/搜索此镜像,并替换文件中地址承担
- kubectl apply -f kubeStateMetrics-deployment.yaml
- 所有失败的节点同上操作
- 修改grafana时区,否则grafana时间显示不准确