通过 Helm 一键安装 Prometheus 和 Grafana

836 阅读1分钟

1. 安装helm

2. 添加helm的监控仓库

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts

3. 查看当前仓库

helm repo list

4. 更新仓库

helm repo update

5. 创建k8s 监控命名空间monitor

kubectl create ns monitor

6. 安装

helm install prometheus-stack prometheus-community/kube-prometheus-stack -n monitor

7. 查看

kubectl --namespace monitor get pods -l "release=prometheus-stack"

8. 查看命名空间下所有的

kubectl get all -n monitor

9. 开启外部访问prometheus http://127.0.0.1:9090

kubectl port-forward -n monitor prometheus-prometheus-stack-kube-prom-prometheus-0 9090

image.png

10. 开启外部访问grafana http://127.0.0.1:3000,默认用户名是 admin,密码是 prom-operator

kubectl port-forward -n monitor prometheus-stack-grafana-5b6dd6b5fb-rtp6z 3000

image.png

image.png