IBM Support

kubectl top pods and docker stats show different memory statistics

Troubleshooting


Problem

The output from kubectl top pod <POD> and  docker stats <ContainerID> returns unmatching memory statitics.
For example:
[root@icp1 ~]# kubectl top pod icp-mongodb-2 -n kube-system
NAME CPU(cores) MEMORY(bytes)
icp-mongodb-2 28m 1510Mi ################################################################### [root@icp1 ~]# docker stats --no-stream 15d29f7aa89c
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS 15d29f7aa89c k8s_icp-mongodb_icp-mongodb-2_kube-system_29db5101-0c29-11ea-9808-000c2943687d_0 1.94% 1.214GiB / 23.39GiB 5.19% 0B / 0B 68.4MB / 64.9GB 398 ################################################################### The memory usage from "kubectl top" is about 1.5GB while from the output from docker stats it is 1.2GB.
The difference is even more evident for others containers.
It is not clear if one of the two tools is wrong or if they are collecting different type of data.

Document Location

Worldwide

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSBS6K","label":"IBM Cloud Private"},"Component":"","Platform":[{"code":"PF016","label":"Linux"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB77","label":"Automation Platform"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
05 March 2020

UID

ibm13373017