目录
[查看custom metrics api](#查看custom metrics api)
介绍
名称 | 配置 | 版本 | 系统版本 |
---|---|---|---|
master | 4核8G | 1.20.1 | centos7.9 |
node1 | 2核4G | 1.20.1 | centos7.9 |
node2 | 2核4G | 1.20.1 | centos7.9 |
node3 | 2核4G | 1.20.1 | centos7.9 |
prometheus-operator | - | v0.9.0 | - |
镜像下载
下载镜像 [0.9.0]
docker pull quay.io/prometheus/alertmanager:v0.21.0
docker pull quay.io/prometheus/blackbox-exporter:v0.18.0
docker pull jimmidyson/configmap-reload:v0.5.0
docker pull quay.io/brancz/kube-rbac-proxy:v0.9.0
docker pull grafana/grafana:7.5.4
docker pull k8s.gcr.io/kube-state-metrics/kube-state-metrics:v2.1.1
docker pull quay.io/prometheus/node-exporter:v1.1.2
docker pull k8s.gcr.io/prometheus-adapter/prometheus-adapter:v0.9.0
docker pull quay.io/prometheus/prometheus:v2.26.0
docker pull quay.io/prometheus-operator/prometheus-operator:v0.47.0
镜像0.9.0
服务安装
[root@k8s-master ~]# wget https://codeload.github.com/prometheus-operator/kube-prometheus/tar.gz/refs/tags/v0.9.0
[root@k8s-master ~]# tar xf v0.9.0
[root@k8s-master ~]# cd kube-prometheus-0.9.0/manifests
安装prometheus-operator
[root@k8s-master ~]# kubectl apply -f setup/
[root@k8s-master ~]# kubectl get pods -n monitoring # 查看pod全部RUNNING之后再执行后面指令
[root@k8s-master ~]# kubectl apply -f .
[root@k8s-master ~]# kubectl get pods -n monitoring # 等待podRUNNING
查看custom metrics api
[root@k8s-master ~]# kubectl get apiservices -n monitoring | grep metrics
获取prometheus端口
[root@k8s-master ~]# kubectl get svc -n monitoring
配置ingress
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: ingress namespace: monitoring labels: name: ingress spec: ingressClassName: nginx rules: - host: grafana.qf.com http: paths: - pathType: Prefix path: "/" backend: service: name: grafana port: number: 3000 - host: prometheus.qf.com http: paths: - pathType: Prefix path: "/" backend: service: name: prometheus-k8s port: number: 9090 - host: alert.qf.com http: paths: - pathType: Prefix path: "/" backend: service: name: alertmanager-main port: number: 9093
页面展示
导入grafana仪表盘
仪表盘id 13105 、8919
13105
8919
希望能够帮助到大家!!!