概述
Prometheus的官方文档部署不太好看,参照一个博客和开源项目,可以快速部署Prometheus到Kubernetes
部署过程
git clone https://github.com/techiescamp/kubernetes-prometheus
kubectl create namespace monitoring
k create -f prometheus-service.yaml
# 修改config-map.yaml,参考链接2
# 在data域增加
web.yml: |-
basic_auth_users:
admin: 'XXX'
# 在prometheus-deployment.yaml增加
args:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus/"
- "--web.config.file=/etc/prometheus/web.yml"
k apply -f config-map.yaml
k replace -f prometheus-deployment.yaml
k create -f prometheus-service.yaml
# 通过nodePort访问dashboard