环境:
CentOS 7.8 (Linux 4.4.237-1.el7.elrepo.x86_64)
Kubernetes v1.15.1
问题:
[root@k8s-master1 ~/k8s]# kubectl top pod myapp-v1
Error from server (NotFound): the server could not find the requested resource (get services http:heapster:)
原因:
heapster是容器集群监控和性能分析工具,HPA、Dashborad、kubectl top都依赖于heapster收集的数据;但是heapster从kubernetes v1.8以后已经被metrics-server所替代
解决办法:部署metrics-server即可
git clone https://github.com/kodekloudhub/kubernetes-metrics-server.git
kubectl create -f kubernetes-metrics-server/