<p>I have this query:</p>
<pre><code>100 * (1 - ((avg_over_time(node_memory_MemFree_bytes[10m]) + avg_over_time(node_memory_Cached_bytes[10m]) + avg_over_time(node_memory_Buffers_bytes[10m])) / avg_over_time(node_memory_MemTotal_bytes[10m])))
</code></pre>
<p>However it only returns the namespace where Prometheus is installed:</p>
<pre><code>{instance=&quot;10.240.0.11:9100&quot;, job=&quot;kubernetes-service-endpoints&quot;, kubernetes_name=&quot;node-exporter&quot;, kubernetes_namespace=&quot;monitoring&quot;}
5.58905365516873
{instance=&quot;10.240.0.11:9100&quot;, job=&quot;node-exporter&quot;}
5.588556605118522
{instance=&quot;10.240.0.42:9100&quot;, job=&quot;kubernetes-service-endpoints&quot;, kubernetes_name=&quot;node-exporter&quot;, kubernetes_namespace=&quot;monitoring&quot;}
5.093870850709847
{instance=&quot;10.240.0.42:9100&quot;, job=&quot;node-exporter&quot;}
5.09401539556571
{instance=&quot;10.240.0.90:9100&quot;, job=&quot;kubernetes-service-endpoints&quot;, kubernetes_name=&quot;node-exporter&quot;, kubernetes_namespace=&quot;monitoring&quot;}
5.103046564234582
{instance=&quot;10.240.0.90:9100&quot;, job=&quot;node-exporter&quot;}
</code></pre>
<p>Is it possible to have a similar query that queries the entire cluster, all nodes and namespaces? If yes, how?</p>

<p>With the node-exporter installed as daemonset, you have the metrics of the entire cluster.</p>
<p>To have the overall cluster memory usage, in percentage:</p>
<pre><code>100 * (
 sum(node_memory_MemTotal_bytes{service=&quot;node-exporter&quot;}) -
 sum(node_memory_MemAvailable_bytes{service=&quot;node-exporter&quot;})
) / sum(node_memory_MemTotal_bytes{service=&quot;node-exporter&quot;})
</code></pre>
<p>Result, for example:</p>
<pre><code>{}   37.234674067149946
</code></pre>
<p>Memory usage by node:</p>
<pre><code>100 * (
 sum by (instance) (node_memory_MemTotal_bytes{service=&quot;node-exporter&quot;}) - 
 sum by (instance) (node_memory_MemAvailable_bytes{service=&quot;node-exporter&quot;})
) / sum by (instance) (node_memory_MemTotal_bytes{service=&quot;node-exporter&quot;})
</code></pre>
<p>Result, for example:</p>
<pre><code>{instance=&quot;x.x.x.x:9100&quot;}   42.51742364002058
{instance=&quot;y.y.y.y:9100&quot;}   38.26956501095188
{instance=&quot;z.z.z.z:9100&quot;}   36.57150031634585

</code></pre>
<p>Memory usage for a specific namespace:</p>
<pre><code>100 * sum(container_memory_working_set_bytes{namespace=&quot;my-namespace&quot;}) / 
sum(node_memory_MemTotal_bytes)
</code></pre>
<p>Result, for example:</p>
<pre><code>{} 4.212481093513011
</code></pre>
