共计 2227 个字符,预计需要花费 6 分钟才能阅读完成。
本篇文章,所使用的任何镜像和 yaml 我都会发一个网盘链接,供大家下载学习!链接:https://pan.baidu.com/s/1inmW… 密码:92uagithub:https://github.com/heyangguang 有任何问题可以直接联系我的 Email:heyangev@cn.ibm.com
Heapster 是一个收集者,将每个 Node 上的 cAdvisor 的数据进行汇总,然后导到第三方工具 (如 InfluxDB)。
Heapster 介绍
架构图:
Heapster 首先从 K8S Master 获取集群中所有 Node 的信息,然后通过这些 Node 上的 kubelet 获取有用数据,而 kubelet 本身的数据则是从 cAdvisor 得到。所有获取到的数据都被推到 Heapster 配置的后端存储中,并还支持数据的可视化。现在后端存储 + 可视化的方法,如 InfluxDB + grafana。
部署实施:
下载 heapster 镜像,上传 heapster.yaml、heapster-mod.yaml 文件 apply 就可以了。
k8smaster:
[root@k8smaster ~]# docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/heapster-amd64:v1.5.4
Trying to pull repository registry.cn-hangzhou.aliyuncs.com/google_containers/heapster-amd64 …
v1.5.4: Pulling from registry.cn-hangzhou.aliyuncs.com/google_containers/heapster-amd64
91380601464e: Pull complete
f351486260ed: Pull complete
Digest: sha256:c4a8d9c0007abb73a1b9e4f9c8bfb044e475aae2b4e6276ab2f8b13959cf6949
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/google_containers/heapster-amd64:v1.5.4
[root@k8smaster ~]# ls
anaconda-ks.cfg heapster-mod.yaml heapster.yaml images.tar kube-flannel.yml
[root@k8smaster ~]# kubectl apply -f heapster.yaml
serviceaccount/heapster created
clusterrolebinding.rbac.authorization.k8s.io/heapster created
deployment.apps/heapster created
service/heapster created
[root@k8smaster ~]# kubectl apply -f heapster-mod.yaml
Warning: kubectl apply should be used on resource created by either kubectl create –save-config or kubectl apply
clusterrole.rbac.authorization.k8s.io/system:heapster configured
查看状态:
[root@k8smaster ~]# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
coredns-86c58d9df4-kmfct 1/1 Running 0 23m
coredns-86c58d9df4-qn2k2 1/1 Running 0 23m
etcd-k8smaster 1/1 Running 0 23m
heapster-569b679494-rktzf 1/1 Running 0 18s
kube-apiserver-k8smaster 1/1 Running 1 22m
kube-controller-manager-k8smaster 1/1 Running 0 22m
kube-flannel-ds-amd64-9rmfz 1/1 Running 0 19m
kube-flannel-ds-amd64-vnwtf 1/1 Running 0 15m
kube-flannel-ds-amd64-x7q4s 1/1 Running 0 15m
kube-proxy-7zl9n 1/1 Running 0 22m
kube-proxy-t2sx9 1/1 Running 0 23m
kube-proxy-txsfr 1/1 Running 0 22m
kube-scheduler-k8smaster 1/1 Running 0 23m
稍等一会,使用 kubectl top node 查看集群状态即可:
[root@k8smaster ~]# kubectl top node
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
k8smaster 122m 3% 2848Mi 8%
k8snode-1 27m 0% 603Mi 1%
k8snode-2 26m 0% 582Mi 1%
到这里 heapster 收集集群数据教程就完成了!
希望大家可以给我指出问题,我们一起前进!
谢谢大家!