简介
kube-prometheus 是一整套监控解决方案,它使用 Prometheus 采集集群指标,Grafana 做展示,包含如下组件:
- The Prometheus Operator
- Highly available Prometheus
- Highly available Alertmanager
- Prometheus node-exporter
- Prometheus Adapter for Kubernetes Metrics APIs (k8s-prometheus-adapter)
- kube-state-metrics
- Grafana
二、安装
环境说明
操作系统:centos 7.6
k8s版本:1.18.1
ip地址:10.212.82.63
主机名:k8s-master
配置:2核2g
操作系统:centos 7.6
k8s版本:1.18.1
ip地址:10.212.82.65
主机名:k8s-node01
配置:2核8g
下载项目
以下步骤,请在k8s-master上执行。
安装git工具
yum install -y git
克隆kube-prometheus
git clone https://github.com/coreos/kube-prometheus
查看manifest
[root@k8s-master]# cd kube-prometheus/manifests/ [root@k8s-master manifests]# ll
输出:
总用量 1696 -rw-r--r-- 1 root root 405 12月 17 10:25 alertmanager-alertmanager.yaml -rw-r--r-- 1 root root 964 12月 17 10:17 alertmanager-secret.yaml -rw-r--r-- 1 root root 96 12月 17 10:17 alertmanager-serviceAccount.yaml -rw-r--r-- 1 root root 254 12月 17 10:17 alertmanager-serviceMonitor.yaml -rw-r--r-- 1 root root 326 12月 17 10:20 alertmanager-service.yaml -rw-r--r-- 1 root root 550 12月 17 10:17 grafana-dashboardDatasources.yaml -rw-r--r-- 1 root root 1403795 12月 17 10:17 grafana-dashboardDefinitions.yaml -rw-r--r-- 1 root root 454 12月 17 10:17 grafana-dashboardSources.yaml -rw-r--r-- 1 root root 7722 12月 17 10:17 grafana-deployment.yaml -rw-r--r-- 1 root root 86 12月 17 10:17 grafana-serviceAccount.yaml -rw-r--r-- 1 root root 208 12月 17 10:17 grafana-serviceMonitor.yaml -rw-r--r-- 1 root root 273 12月 17 10:20 grafana-service.yaml -rw-r--r-- 1 root root 376 12月 17 10:17 kube-state-metrics-clusterRoleBinding.yaml -rw-r--r-- 1 root root 1651 12月 17 10:17 kube-state-metrics-clusterRole.yaml -rw-r--r-- 1 root root 2127 12月 17 10:18 kube-state-metrics-deployment.yaml -rw-r--r-- 1 root root 192 12月 17 10:17 kube-state-metrics-serviceAccount.yaml -rw-r--r-- 1 root root 829 12月 17 10:17 kube-state-metrics-serviceMonitor.yaml -rw-r--r-- 1 root root 403 12月 17 10:17 kube-state-metrics-service.yaml -rw-r--r-- 1 root root 266 12月 17 10:17 node-exporter-clusterRoleBinding.yaml -rw-r--r-- 1 root root 283 12月 17 10:17 node-exporter-clusterRole.yaml -rw-r--r-- 1 root root 2880 12月 17 10:18 node-exporter-daemonset.yaml -rw-r--r-- 1 root root 92 12月 17 10:17 node-exporter-serviceAccount.yaml -rw-r--r-- 1 root root 669 12月 17 10:17 node-exporter-serviceMonitor.yaml -rw-r--r-- 1 root root 315 12月 17 10:17 node-exporter-service.yaml -rw-r--r-- 1 root root 292 12月 17 10:17 prometheus-adapter-apiService.yaml -rw-r--r-- 1 root root 396 12月 17 10:17 prometheus-adapter-clusterRoleAggregatedMetricsReader.yaml -rw-r--r-- 1 root root 304 12月 17 10:17 prometheus-adapter-clusterRoleBindingDelegator.yaml -rw-r--r-- 1 root root 281 12月 17 10:17 prometheus-adapter-clusterRoleBinding.yaml -rw-r--r-- 1 root root 188 12月 17 10:17 prometheus-adapter-clusterRoleServerResources.yaml -rw-r--r-- 1 root root 219 12月 17 10:17 prometheus-adapter-clusterRole.yaml -rw-r--r-- 1 root root 1378 12月 17 10:17 prometheus-adapter-configMap.yaml -rw-r--r-- 1 root root 1333 12月 17 10:18 prometheus-adapter-deployment.yaml -rw-r--r-- 1 root root 325 12月 17 10:17 prometheus-adapter-roleBindingAuthReader.yaml -rw-r--r-- 1 root root 97 12月 17 10:17 prometheus-adapter-serviceAccount.yaml -rw-r--r-- 1 root root 408 12月 17 10:17 prometheus-adapter-serviceMonitor.yaml -rw-r--r-- 1 root root 236 12月 17 10:17 prometheus-adapter-service.yaml -rw-r--r-- 1 root root 269 12月 17 10:17 prometheus-clusterRoleBinding.yaml -rw-r--r-- 1 root root 216 12月 17 10:17 prometheus-clusterRole.yaml -rw-r--r-- 1 root root 621 12月 17 10:17 prometheus-operator-serviceMonitor.yaml -rw-r--r-- 1 root root 800 12月 17 10:25 prometheus-prometheus.yaml -rw-r--r-- 1 root root 293 12月 17 10:17 prometheus-roleBindingConfig.yaml -rw-r--r-- 1 root root 983 12月 17 10:17 prometheus-roleBindingSpecificNamespaces.yaml -rw-r--r-- 1 root root 188 12月 17 10:17 prometheus-roleConfig.yaml -rw-r--r-- 1 root root 1141 12月 17 10:17 prometheus-roleSpecificNamespaces.yaml -rw-r--r-- 1 root root 99490 12月 17 10:17 prometheus-rules.yaml -rw-r--r-- 1 root root 93 12月 17 10:17 prometheus-serviceAccount.yaml -rw-r--r-- 1 root root 6821 12月 17 10:17 prometheus-serviceMonitorApiserver.yaml -rw-r--r-- 1 root root 395 12月 17 10:17 prometheus-serviceMonitorCoreDNS.yaml -rw-r--r-- 1 root root 6310 12月 17 10:17 prometheus-serviceMonitorKubeControllerManager.yaml -rw-r--r-- 1 root root 7126 12月 17 10:17 prometheus-serviceMonitorKubelet.yaml -rw-r--r-- 1 root root 485 12月 17 10:17 prometheus-serviceMonitorKubeScheduler.yaml -rw-r--r-- 1 root root 247 12月 17 10:17 prometheus-serviceMonitor.yaml -rw-r--r-- 1 root root 315 12月 17 10:19 prometheus-service.yaml drwxr-xr-x 2 root root 4096 12月 17 10:18 setup