1.1、下载
git clone -b release-0.7 --single-branch https://github.com/coreos/kube-prometheus.git
1.2、安装operator
[root@k8s-master01 ~]# cd /root/kube-prometheus/manifests/setup
[root@k8s-master01 setup]# kubectl create -f .
# 查看是否Running
[root@k8s-master01 ~]# kubectl get pod -n monitoring
NAME READY STATUS RESTARTS AGE
prometheus-operator-848d669f6d-bz2tc 2/2 Running 0 4m16s
1.3、安装Prometheus
[root@k8s-master01 ~]# cd /root/kube-prometheus/manifests
[root@k8s-master01 manifests]# kubectl create -f .
1.4、创建ingress
# 创建一下Ingress代理三个service
# 创建一下Ingress代理三个service
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
generation: 1
name: prom-ingresses
namespace: monitoring
spec:
rules:
- host: alert.test.com
http:
paths:
- backend:
serviceName: alertmanager-main
servicePort: 9093
path: /
- host: grafana.test.com
http:
paths:
- backend:
serviceName: grafana
servicePort: 3000
path: /
- host: prome.test.com
http:
paths:
- backend:
serviceName: prometheus-k8s
servicePort: 9090
path: /
1.5、页面访问
# 在你Windows的hosts文件添加主机映射,浏览器访问即可
192.168.1.104 krm.test.com alert.test.com grafana.test.com prome.test.com