mkdir Prometheus
cd Prometheus
git clone https://github.com/coreos/kube-prometheus.git
cd kube-prometheus/manifests
grafana,prometheus和alertmanager改用nodeport方式访问,以下只是SVC添加部分:
grafana-service.yaml
spec:
type: NodePort
nodePort: 30100
prometheus-service.yaml
spec:
type: NodePort
nodePort: 30200
alertmanager-service.yaml
spec:
type: NodePort
nodePort: 30300
cd ..
kubectl create -f manifests/setup
kubectl apply -f manifests/
# 获取svc信息
kubectl get svc -n monitoring
端口
prometheus:30200
grafana:30100(admin/admin)
alertmanager:30300
一些小问题:
由于时区不匹配,所以登录Prometheus后感觉收不到数据,直接在Grafana的web端改时区看即可。
想解决Prometheus时区的话,可以进入pod肉改,或者建pod的时候改环境变量,再或者修改kube-apiserver.yaml用Pod Pres的方式改。当然,我一个懒人,没根本就没改,感觉并不影响使用。
参考:
https://blog.51cto.com/flyfish225/2484483
https://mp.weixin.qq.com/s?__biz=MzAwNTM5Njk3Mw==&mid=2247488259&idx=1&sn=2b358decb83ab65709ff2b451b58d901&chksm=9b1c1381ac6b9a97ec9c25d13ed526c3bfb552e2b49b67807e3484dded78d20758862f72f32b&scene=27#wechat_redirect
https://www.cnblogs.com/zhangb8042/p/11321970.html
grafana中dashboards官方下载地址:https://grafana.com/grafana/dashboards