mkdir -pv /home/lvqingshan/prometheus/ git clone https://github.com/coreos/prometheus-operator.git
cd /home/lvqingshan/prometheus/prometheus-operator/contrib/kube-prometheus #修改nodePort到kubernetes容許的範圍 vim manifests/prometheus/prometheus-k8s-service.yaml nodePort: 8990 vim manifests/grafana/grafana-service.yaml nodePort: 8992 vim manifests/alertmanager/alertmanager-service.yaml nodePort: 8993
cd /home/lvqingshan/prometheus/prometheus-operator/contrib/kube-prometheus #注意由於prometheus的部署腳本用了相對路徑,因此必定要進入克隆到本地的prometheus的prometheus-operator/contrib/kube-prometheus目錄來執行prometheus的部署與移除 #部署: hack/cluster-monitoring/deploy #移除: hack/cluster-monitoring/teardown #由於網絡緣由,下載images的速度會很是很是慢,至少2-4小時纔會部署好 #查看是否部署好用: kubectl get pods -n monitoring #若是結果所有爲run則部署完成
進入kubernets-dashboard查看grafana對應的pod所在的主機node
找到service中grafana的NodePort端口git
瀏覽器中訪問github
http://172.19.2.51:8992vim