Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes 1.11 could not find heapster for metrics

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

like image 746
FakeAccount Avatar asked Oct 17 '18 17:10

FakeAccount


People also ask

How do you use Kubectl top command?

We execute the command “kubectl top pod –namespace default”. This command displays the metrics in the default namespace. Whenever we need to obtain the metric from any definite namespace, we need to identify the namespace: We observe that the various indicators are not occurring in large numbers.

What is Heapster Kubernetes?

Heapster is a cluster-wide aggregator of monitoring and event data. It currently supports Kubernetes natively and works on all Kubernetes setups. Heapster runs as a pod in the cluster, similar to how any Kubernetes application would run.


2 Answers

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.

like image 127
Farshid Avatar answered Nov 10 '22 14:11

Farshid


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

like image 39
Rico Avatar answered Nov 10 '22 14:11

Rico