The metrics of kubectl top nodes is not correct?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
In the Kubernetes ecosystem, the `kubectl top` command plays a crucial role in providing insights into resource usage per node or pod. However, many users have reported discrepancies in the metrics reported by `kubectl top nodes`. These discrepancies often lead to confusion and inefficiencies in resource management. This article delves into potential reasons for these inconsistencies, provides technical explanations, and offers insights into how to mitigate these issues.
Understanding `kubectl top`
The `kubectl top` command is often used to gather resource metrics such as CPU and memory usage across nodes and pods. This command relies on the metrics-server to provide these statistics, which collects them from different sources within the Kubernetes environment.
Example Usage
To check the resource usage for nodes, you would typically use:
- Network Permissions: The metrics-server needs appropriate permissions to communicate with nodes. Misconfigured nodes or network policies may impede this.
- Resource Allocation: If the server is under-provisioned, it may struggle to gather and report data in a timely manner.
- Data Intervals: Metrics might be averaged over periods longer than expected, leading to a smoothing effect where peak usages are under-represented.
- Different Units: Metrics may be represented in different units than what users commonly monitor externally, like mCPU vs. CPU cores.
Related reading
- The node was low on resource ephemeral-storage
- Timeout for Kubectl exec
- Tool to create mongodb sharded cluster
- Tradeoff between building own distributed system and using kubernetes to deploy my application
- The most efficient way to implement an integer based power function powint, int
- The performance impact of using instanceof in Java
- The model item passed into the dictionary is of type ‘mvc.Models.ModelA’ but this dictionary requires a model item of type ‘mvc.Models.ModelB‘
- the MySQL service on local computer started and then stopped

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.