K8S环境部署Prometheus
记录在K8S 1.18版本环境下部署Prometheus 0.5版本。
1. 下载kube-prometheus仓库
git clone https://github.com/coreos/kube-prometheus.git
cd kube-prometheus
笔者安装的K8S版本是1.18 ,prometheus选择配套的分支release-0.5:
# 切换到release-0.5
git checkout remotes/origin/release-0.5 -b 0.5
K8S和Pormetheus的配套关系:
kube-prometheus stack | Kubernetes 1.14 | Kubernetes 1.15 | Kubernetes 1.16 | Kubernetes 1.17 | Kubernetes 1.18 |
---|---|---|---|---|---|
release-0.3 |
✔ | ✔ | ✔ | ✔ | ✗ |
release-0.4 |
✗ | ✗ | ✔ | ✔ | ✗ |
release-0.5 |
✗ | ✗ | ✗ | ✗ | ✔ |
HEAD |
✗ | ✗ | ✗ | ✗ | ✔ |
最新的版本配套关系查看kube-prometheus官方仓库:https://github.com/prometheus-operator/kube-prometheus ,可以切换版本查看配套关系。
2. 查看manifest
[root@k8s-master kube-prometheus]# cd manifests/
[root@k8s-master manifests]# ll
total 1684
-rw-r--r-- 1 root root 405 Jun 12 16:20 alertmanager-alertmanager.yaml
-rw-r--r-- 1 root root 973 Jun 12 16:20 alertmanager-secret.yaml
-rw-r--r-- 1 root root 96 Jun 12 16:20 alertmanager-serviceAccount.yaml
-rw-r--r-- 1 root root 254 Jun 12 16:20 alertmanager-serviceMonitor.yaml
-rw-r--r-- 1 root root 308 Jun 12 16:22 alertmanager-service.yaml
-rw-r--r-- 1 root root 550 Jun 12 16:20 grafana-dashboardDatasources.yaml
-rw-r--r-- 1 root root 1405645 Jun 12 16:20 grafana-dashboardDefinitions.yaml
-rw-r--r-- 1 root root 454 Jun 12 16:20 grafana-dashboardSources.yaml
-rw-r--r-- 1 root root 7539 Jun 12 16:20 grafana-deployment.yaml
-rw-r--r-- 1 root root 86 Jun 12 16:20 grafana-serviceAccount.yaml
-rw-r--r-- 1 root root 208 Jun 12 16:20 grafana-serviceMonitor.yaml
-rw-r--r-- 1 root root 238 Jun 12 16:22 grafana-service.yaml
-rw-r--r-- 1 root root 376 Jun 12 16:20 kube-state-metrics-clusterRoleBinding.yaml
-rw-r--r-- 1 root root 1651 Jun 12 16:20 kube-state-metrics-clusterRole.yaml
-rw-r--r-- 1 root root 1925 Jun 12 16:20 kube-state-metrics-deployment.yaml
-rw-r--r-- 1 root root 192 Jun 12 16:20 kube-state-metrics-serviceAccount.yaml
-rw-r--r-- 1 root root 829 Jun 12 16:20 kube-state-metrics-serviceMonitor.yaml
-rw-r--r-- 1 root root 403 Jun 12 16:20 kube-state-metrics-service.yaml
-rw-r--r-- 1 root root 266 Jun 12 16:20 node-exporter-clusterRoleBinding.yaml
-rw-r--r-- 1 root root 283 Jun 12