<p>I am using this query to calculate memory utilization of a node</p>
<pre class="lang-sh prettyprint-override"><code> (1 - node_memory_MemAvailable_bytes{cluster=&quot;$cluster&quot;}/node_memory_MemTotal_bytes{cluster=&quot;$cluster&quot;}) * 100
</code></pre>
<p>I see values around 25%</p>
<p>but when I run <code>kubectl top node</code> for the same node I see a value around 16%</p>

<p>The difference in values between <code>kubectl top node</code> and Prometheus's node exporter values comes from the way these data is being collected and calculated.</p>
<p>When you execute <code>kubectl top node</code> Kubernetes reads values from root cgroup. Specifically from <code>/sys/fs/cgroup/memory/memory.usage_in_bytes</code> and
<code>/sys/fs/cgroup/memory/memory.stat</code>. The total memory usage is being calculated as: <code>memory.usage_in_bytes</code> - <code>total_inactive_file</code>.</p>
<p>However, Prometheus's node exporter reads values from <code>/proc/meminfo</code> and than calculates it according to your query which seems correct.</p>
<p>This difference is also being discussed in this (still open) <a href="https://github.com/google/cadvisor/issues/2042" rel="nofollow noreferrer">issue</a>.</p>
<p>One way of dealing with it would be to simply stick to one method of measurement and reporting.</p>
