k8s生产部署(八):prometheus搭建
2021-03-20 19:51:21我们使用prometheus-operator来搭建
1、查看可使用的版本
helm repo add stable http://mirror.azure.cn/kubernetes/charts/
helm repo update
helm repo list
helm search repo prometheus-operator --versions
2、拉去指定版本的配置
helm pull stable/prometheus-operator --version=9.3.2
tar -xf stable-prometheus-operator-9.3.2.tgz
3、修改配置
配置内容比较多,要修改的信息如下:
分节编辑
1. alertmanager
enabled: true
ingress:
enabled: true
hosts:
- alert.qhfinance.com
2. grafana
enabled: true
adminPassword: admin
ingress:
enabled: true
hosts:
- grafana.qhfinance.com
3. prometheus
enabled: true
ingress:
enabled: true
hosts:
- pus.qhfinance.com
additionalServiceMonitors: #配置自己的监控服务
- name: "hc"
namespaceSelector:
any: true
selector:
matchLabels:
qjy: app-metrics #凡是打上了qjy的标签都会监控
endpoints:
- path: /metrics
port: http
- name: ""
namespaceSelector:
any: true
selector:
matchLabels:
qjy: app-metrics #凡是打上了qjy的标签都会监控
endpoints:
- path: /metrics
port: http
4、执行
kubectl create namespace qjy-apm
helm install prometheus-operator -f prometheus-operator-values.yaml --namespace qjy-apm stable/prometheus-operator --version 9.3.2
安装时有一些警告,不用管