Is kubectl top the current memory / CPU value or is it an average of a certain time period ?
Asked
Active
Viewed 5,036 times
2 Answers
10
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.

Rico
- 58,485
- 12
- 111
- 141
0
"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].

lcyqbq
- 1
- 1