从Heapster
的github 中可以看到已经,heapster
已经DEPRECATED
。 这里是heapster
的deprecation timeline。 可以看出heapster
从Kubernetes 1.12
开始从Kubernetes
各种安装脚本中移除。
Kubernetes
推荐使用metrics-server
。我们这里也使用helm
来部署metrics-server
。
创建配置metrics-server.yaml
replicaCount: 1
image:
repository: hub.deri.org.cn/k8s/metrics-server-amd64
tag: v0.3.5
pullPolicy: IfNotPresent
args:
- --logtostderr
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP
nodeSelector:
node-role.kubernetes.io/edge: ''
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
- key: node-role.kubernetes.io/master
operator: Exists
effect: PreferNoSchedule
安装
helm install stable/metrics-server \
-n metrics-server \
--namespace kube-system \
-f metrics-server.yaml
使用
kubectl top node
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
node1 650m 32% 1276Mi 73%
node2 73m 3% 527Mi 30%
kubectl top pod -n kube-system
NAME CPU(cores) MEMORY(bytes)
coredns-5c98db65d4-dr8lf 8m 7Mi
coredns-5c98db65d4-lp8dg 6m 8Mi
etcd-node1 44m 46Mi
kube-apiserver-node1 74m 295Mi
kube-controller-manager-node1 35m 50Mi
kube-flannel-ds-amd64-7lwm9 2m 8Mi
kube-flannel-ds-amd64-mm296 5m 9Mi
kube-proxy-7fsrg 1m 11Mi
kube-proxy-k8vhm 3m 11Mi
kube-scheduler-node1 8m 15Mi
kubernetes-dashboard-848b8dd798-c4sc2 2m 14Mi
metrics-server-8456fb6676-fwh2t 10m 19Mi
tiller-deploy-7bf78cdbf7-9q94c 1m 16Mi
遗憾的是,当前
Kubernetes Dashboard
还不支持metrics-server
。因此如果使用metrics-server
替代了heapster
,将无法在dashboard
中以图形展示Pod
的内存和CPU
情况。计划在dashboard 2.0版本以后才会支持,尽情期待~