执行kubectl top node报错,是因为pod-metrics-server 还没完全部署成功,需要稍等一会。心急吃不了热豆腐。
[root@master 1.8+]# kubectl top node
error: metrics not available yet
[root@master 1.8+]# kubectl top node
error: metrics not available yet
[root@master 1.8+]# kubectl top node
error: metrics not available yet
[root@master 1.8+]# kubectl top node
error: metrics not available yet
[root@master 1.8+]# kubectl top node
error: metrics not available yet
[root@master 1.8+]# kubectl top node
error: metrics not available yet
[root@master 1.8+]# kubectl top node
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
192.168.159.11 384m 19% 1587Mi 55%
192.168.159.12 99m 4% 221Mi 11%
192.168.159.13 94m 4% 264Mi 14%
[root@master 1.8+]# vim metrics-server-deployment.yaml
[root@master 1.8+]# kubectl top pod -n kube-system
NAME CPU(cores) MEMORY(bytes)
coredns-59748948d4-2kjtk 7m 31Mi
metrics-server-5f55b696bd-s92pl 2m 10Mi
安装metrics-server详情请看
https://blog.csdn.net/weixin_45387943/article/details/123250930