The metrics of kubectl top nodes is not correct?

12/14/2018

I try to get CPU/Memory usage of the k8s Cluster Nodes via metrics-server API, but I found the returned values of metrics-server is lower than actual used CPU/Memory.

The output of kubectl top command : kubectl top nodes

enter image description here

The following is the output of the free command, from which you could see the memory usage is great than 90%.

enter image description here

Why the difference is so high?

-- zulv
kubernetes

1 Answer

12/14/2018

kubectl top nodes is reflecting the actual usage of your Kubernetes Nodes.

For example:

Your node has 60GB memory and you actually use 30GB so it will be 50% of usage.

But you can request for example:

100 MB and have a limit 200MB memory.

This doesn't mean you only consume 0.16% (100 / 60000) memory, but the amount of your configuration.

--
Source: StackOverflow