Kubernetes 1.11 could not find heapster for metrics
Asked Answered
A

2

13

I'm using Kubernetes 1.11 on Digital Ocean, when I try to use kubectl top node I get this error:

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

but as stated in the doc, heapster is deprecated and no longer required from kubernetes 1.10

Asafoetida answered 17/10, 2018 at 17:8 Comment(3)
Seems to be a present issue: github.com/kubernetes/kubernetes/issues/46915Frankhouse
What does 'kubectl get ns' say?Frankhouse
What does 'kubectl get pods --all-namespaces' report?Frankhouse
C
19

If you are running a newer version of Kubernetes and still receiving this error, there is probably a problem with your installation.

Please note that to install metrics server on kubernetes, you should first clone it by typing:

git clone https://github.com/kodekloudhub/kubernetes-metrics-server.git

then you should install it, WITHOUT GOING INTO THE CREATED FOLDER AND WITHOUT MENTIONING AN SPECIFIC YAML FILE , only via:

kubectl create -f kubernetes-metrics-server/

In this way all services and components are installed correctly and you can run:

kubectl top nodes

or

kubectl top pods

and get the correct result.

Cellulous answered 12/5, 2019 at 14:23 Comment(0)
R
13

For kubectl top node/pod to work you either need the heapster or the metrics server installed on your cluster.

Like the warning says: heapster is being deprecated so the recommended choice now is the metrics server.

So follow the directions here to install the metrics server

Redfaced answered 17/10, 2018 at 19:8 Comment(3)
I installed metrics-server in the cluster in the kube-system namespace, but still getting the same error. if I do kubectl logs kubectl logs metrics-server-85dc785fbf-76qf9 I get this output E1018 12:10:51.797774 1 manager.go:102] unable to fully collect metrics: [unable to fully scrape metrics from source kubelet_summary:nostalgic-pare-gt8: unable to fetch metrics from Kubelet nostalgic-pare-gt8 (nostalgic-pare-gt8): Get https://nostalgic-pare-gt8:10250/stats/summary/: dial tcp: lookup nostalgic-pare-gt8 on 10.245.0.10:53: no such hostAsafoetida
@Asafoetida Use this argument for metrics-server: --kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalIP,ExternalDNSFrontal
I have kube-state-metrics still I get admin@ip-172-21-59-122:~$ kubectl top nodes Error from server (NotFound): the server could not find the requested resource (get services http:heapster:) admin@ip-172-21-59-122:~$ kubectl top nodes -n kube-system Error from server (NotFound): the server could not find the requested resource (get services http:heapster:)Jammie

© 2022 - 2024 — McMap. All rights reserved.