K8s Prometheus

记录&分享K8s Gitlab Prometheus搭建过程。

Helm使k8s基建部署变成一件很容易的事。

1 helm安装

1
2
3
4
5
$ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
$ helm repo update

$ k create ns prome
$ helm install -n prome prome -f prom-values.yaml prometheus-community/prometheus

参考values.yaml

1
2
3
4
5
6
server:
persistentVolume:
storageClassName: gp2 # eks
size: 40Gi
statefulSet:
enabled: true # 方便扩容

2 验证

pod metadata 增加annotations,自动采集指标。

1
2
3
4
5
metadata:
annotations:
prometheus.io/path: /metrics
prometheus.io/port: "6000"
prometheus.io/scrape: "true"

登录grafana,配置promethues源,查看指标。

参考资料


K8s Prometheus
https://a3d21.github.io/2024/04/11/2024-04-11-k8s-prome/
作者
a3d21
发布于
2024年4月11日
许可协议