k8s中kubelet自带cadvisor监控所有节点
参考:https://github.com/google/cadvisor
#在被监控主机(客户端)上部署cAdvisor,IP地址:192.168.1.102[root@nod ~]# docker run --volume=/:/rootfs:ro --volume=/var/run:/var/run:ro --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --volume=/dev/disk/:/dev/disk:ro --publish=8090:8080 --detach=true --name=cadvisor --privileged --device=/dev/kmsg google/cadvisor
访问cAdvisor:http://192.168.1.102:8090/containers/
Prometheus(普罗米修斯):容器监控系统https://prometheus.io/
http://github.com/prometheus
#在服务器上面部署,IP地址:192.168.1.101#1、编辑配置文件prometheus.yml[root@master tmp]# vim prometheus.yml#添加如下内容:global: scrape_interval: 60s evaluation_interval: 60s scrape_configs: - job_name: prometheus static_configs: - targets: ['192.168.1.102:8090'] #客户端cAdvisor的地址 labels: instance: prometheus#启动容器docker run -p 9090:9090 -v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
访问prometheus:http://192.168.1.101:9090
Grafana:是一个开源的度量分析和可视化系统https://grafana.com/grafana/download
https://grafana.com/grafana/dashboards/193(监控docker主机模版)
#在服务器上面部署,IP地址:192.168.1.101[root@master tmp]# docker run -d --name=grafana -p 3000:3000 grafana/grafana
访问Grafana:http://192.168.1.101:3000
用户名:admin
密码:admin
URL为prometheus的访问地址,并且导入“193”的模版