K8S-Prometheus-Grafna部署
1. 效果图展示
2. 参考文章
https://blog.csdn.net/weixin_43143310/article/details/121446123
https://blog.csdn.net/qq_45097352/article/details/121538491
wget https://github.com/prometheus-operator/kube-prometheus/archive/refs/tags/v0.9.0.zip
3. 镜像下载
#这个镜像是博主上传到自己的仓库上了
#如果怕出错的话就把每一个节点都安装这些镜像
docker pull zfhub/prometheus-adapter:v0.9.0
docker pull zfhub/kube-state-metrics:v2.1.1
docker tag zfhub/prometheus-adapter:v0.9.0 k8s.gcr.io/prometheus-adapter/prometheus-adapter:v0.9.0
docker tag zfhub/kube-state-metrics:v2.1.1 k8s.gcr.io/kube-state-metrics/kube-state-metrics:v2.1.1
docker pull quay.io/prometheus/prometheus:v2.29.1
docker pull quay.io/prometheus-operator/prometheus-operator:v0.49.0
docker pull quay.io/prometheus/node-exporter:v1.2.2
docker pull quay.io/prometheus/blackbox-exporter:v0.19.0
docker pull quay.io/prometheus/alertmanager:v0.22.2
docker pull quay.io/brancz/kube-rbac-proxy:v0.11.0
docker pull jimmidyson/configmap-reload:v0.5.0
docker pull grafana/grafana:8.1.1
4. 命令指引
#创建所有
kubectl create -f manifests/setup
kubectl create -f manifests/
#删除所有
kubectl delete -f manifests/
kubectl delete -f manifests/setup/
#把promethus与grafana暴露端口
kubectl -n monitoring patch svc prometheus-k8s -p '{"spec":{"type":"NodePort"}}'
kubectl -n monitoring patch svc grafana -p '{"spec":{"type":"NodePort"}}'
#查看这个名词空间下的所有资源
kubectl -n monitoring get all
#部署的时候可能会失败 因为这个prometheus-k8s-0是需要部署在master节点上的 然后master节点是由污点的 去掉即可