開發與維運

k8s報錯:Error from server (NotFound): the server could not find the requested resource (get services http:heapster:)

環境:
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/

Leave a Reply

Your email address will not be published. Required fields are marked *