<p>As beginener, I have tried k9s and kubernetes '<code>kubectl top nodes</code>',for the cpu and memory usage and values are matched.Meanwhile I tried with prometheus UI, with '<code>avg(container_cpu_user_seconds_total{node=&quot;dev-node01&quot;})</code>' and '<code>avg(container_cpu_usage_seconds_total{node=&quot;dev-node01&quot;})</code>'  for dev-node01. I cant get matching values.Any help will be appreciated as I am beginner.please any help would be appreciated.</p>

Aksahy Awate
<p>The following PromQL query returns CPU usage (as the number of used CPU cores) by pod in every namespace:</p>
<pre><code>sum(rate(container_cpu_usage_seconds_total{container!=&quot;&quot;}[5m])) by (namespace, pod)
</code></pre>
<p>The <code>container!=&quot;&quot;</code> filter is needed for filtering out cgroups hierarchy metrics - see <a href="https://stackoverflow.com/questions/69281327/why-container-memory-usage-is-doubled-in-cadvisor-metrics/69282328#69282328">this answer</a> for details.</p>
<p>The following query returns memory usage by pod in every namespace:</p>
<pre><code>sum(container_memory_usage_bytes{container!=&quot;&quot;}) by (namespace, pod)
</code></pre>
<p>The following query returns CPU usage (as the number of used CPU cores) by node:</p>
<pre><code>sum(rate(container_cpu_usage_seconds_total{container!=&quot;&quot;}[5m])) by (node)
</code></pre>
<p>The following query returns memory usage by node:</p>
<pre><code>sum(container_memory_usage_bytes{container!=&quot;&quot;}) by (node)
</code></pre>
