基於k8s集群部署prometheus監控etcd
1、背景和環境概述
本文中涉及到的環境中、prometheus
監控和grafana
基本環境已部署好。etcd
內置了metrics
接口供收集數據,在etcd
集群任意一台節點上可通過ip:2379/metrics
檢查是否能正常收集數據。
curl -L http://localhost:2379/metrics
2、修改prometheus配置
修改prometheus
的配置,增加對etcd
的監控配置,配置中指定etcd集群的ip:port
,並指定后端協議類型和配置跳過CA驗證
vim prometheus-configmap.yaml
- job_name: "etcd"
scheme: https
tls_config:
insecure_skip_verify: true
static_configs:
- targets: ['172.16.1.100:2379','172.16.1.101:2379','172.16.1.110:2379']
3、檢查是否生效
打開prometheus
界面,查看target
中是否有etcd
的相關記錄
檢查查詢取值
4、配置grafana圖形
在grafana圖形中導入模板,模板可以從grafana
官方dashboard
中搜索並獲得模板id
,這里推薦為3070、9618
查看圖形
至此,prometheus
監控etcd
完成。