Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is kubectl top the current memory / CPU value?

Is kubectl top the current memory / CPU value or is it an average of a certain time period ?

like image 774
user2062360 Avatar asked Oct 18 '25 06:10

user2062360


2 Answers

It's the actual usage of the pods and nodes at the moment you issue the command.

Example:

$ kubectl top nodes
NAME                                         CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
ip-xxx-xx-x-xxx.us-west-2.compute.internal   62m          6%     1014Mi          27%

Using 62 milicores(0.062 cores), 6% of the CPUs, 1014 Mebybites and 24% of the memory at the moment the API returned.

You can also find more information here.

like image 72
Rico Avatar answered Oct 19 '25 21:10

Rico


"kubectl top node" doesn't provide the real-time of nodes's CPU usage. It will have around 5-20 seconds delay. You could check the output of <date; kubectl top nodes; kubectl get --raw "/apis/metrics.k8s.io/v1beta1/nodes"|jq>.

According to the output, you will find those statastics collected from the interval [Timestamp-Window, Timestamp].

like image 33
lcyqbq Avatar answered Oct 19 '25 21:10

lcyqbq



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!