我尝试在我的 3 节点 kubernetes 安装上安装 Prometheus 运算符。
# kubectl cluster-info
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.3+coreos.0", GitCommit:"42de91f04e456f7625941a6c4aaedaa69708be1b", GitTreeState:"clean", BuildDate:"2017-08-07T19:44:31Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.3+coreos.0", GitCommit:"42de91f04e456f7625941a6c4aaedaa69708be1b", GitTreeState:"clean", BuildDate:"2017-08-07T19:44:31Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
# kubectl get nodes
NAME STATUS AGE VERSION
master-k8s Ready 64d v1.7.3+coreos.0
worker1-k8s Ready 64d v1.7.3+coreos.0
worker2-k8s Ready 64d v1.7.3+coreos.0
What i did is
# git clone https://github.com/coreos/prometheus-operator
# cd cd prometheus-operator/
changed default namespace to monitoring at bundle.yaml
# kubectl apply -f bundle.yaml -n monitoring
然后我做了
# cd contrib/kube-prometheus
# hack/cluster-monitoring/deploy
当我查看 Grafana 界面时,我没有看到数据源,所以我应用了 yaml 文件。
# kubectl apply -f manifests/grafana/ -n monitoring
# kubectl get all -n monitoring
AME READY STATUS RESTARTS AGE
po/alertmanager-main-0 2/2 Running 0 8h
po/alertmanager-main-1 2/2 Running 0 8h
po/alertmanager-main-2 2/2 Running 0 8h
po/grafana-3524315691-86bv9 2/2 Running 49 8h
po/kube-state-metrics-1058475279-p9r7b 2/2 Running 0 8h
po/node-exporter-cpz70 1/1 Running 0 8h
po/node-exporter-kt8nx 1/1 Running 0 8h
po/node-exporter-zbj86 1/1 Running 0 8h
po/prometheus-k8s-0 2/2 Running 0 8h
po/prometheus-k8s-1 2/2 Running 0 8h
po/prometheus-operator-2365681585-zpkpb 1/1 Running 0 8h
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
svc/alertmanager-main 172.16.102.56 <nodes> 9093:30903/TCP 8h
svc/alertmanager-operated None <none> 9093/TCP,6783/TCP 8h
svc/grafana 172.16.102.37 <nodes> 3000:30902/TCP 8h
svc/kube-state-metrics 172.16.102.174 <none> 8080/TCP 8h
svc/node-exporter None <none> 9100/TCP 8h
svc/prometheus-k8s 172.16.102.52 <nodes> 9090:30900/TCP 8h
svc/prometheus-operated None <none> 9090/TCP 8h
svc/prometheus-operator 172.16.102.207 <none> 8080/TCP 8h
NAME DESIRED CURRENT AGE
statefulsets/alertmanager-main 3 3 8h
statefulsets/prometheus-k8s 2 2 8h
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
deploy/grafana 1 1 1 1 8h
deploy/kube-state-metrics 1 1 1 1 8h
deploy/prometheus-operator 1 1 1 1 8h
NAME DESIRED CURRENT READY AGE
rs/grafana-3524315691 1 1 1 8h
rs/kube-state-metrics-1058475279 1 1 1 8h
rs/kube-state-metrics-3281504101 0 0 0 8h
rs/prometheus-operator-2365681585 1 1 1 8h
这次可以看到 prometheus 数据源,但没有可用的仪表板。
似乎缺少了什么。任何想法?