<p>I'm new with monitoring tools like Prometheus and Grafana and I would like to create dashboard which represents current <code>requests and limits resources</code> and usage for a pod. In addition, this pod has 2 containers inside.</p>
<p>My resources for first container looks like:</p>
<pre><code> resources:
    requests:
      cpu: &quot;3800m&quot;
      memory: &quot;9500Mi&quot;
    limits:
      cpu: &quot;6500m&quot;
      memory: &quot;9500Mi&quot;
</code></pre>
<p>and for second container:</p>
<pre><code>resources:
   limits:
     cpu: 100m
     memory: 100Mi
   requests:
     cpu: 50m
     memory: 50Mi
</code></pre>
<p>When executing this query in Prometheus:</p>
<p><code>rate(container_cpu_usage_seconds_total{pod=~&quot;MY_POD&quot;}[5m])</code>
I get: <a href="https://i.stack.imgur.com/eBLDV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eBLDV.png" alt="enter image description here" /></a>
And to be honest I dont know how this returned data are valid with resources. On Grafana it looks like this:
<a href="https://i.stack.imgur.com/DGltA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DGltA.png" alt="enter image description here" /></a></p>
<p>In addition I would like to add informations about <code>requests and limits</code> to dashboard, but I don't know how to scale dashboard to show all data.</p>
<p>When I execute this query: <code>kube_pod_container_resource_requests{pod=~&quot;MY_POD&quot;}</code> I get:</p>
<p><a href="https://i.stack.imgur.com/HPGOJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HPGOJ.png" alt="enter image description here" /></a></p>
<p>And this looks valid compared to my resources. I have proper value for limits too, but I would like to represent all this data (usage, requests, limits) on ona dashboard. Could somebody give my any tips how to achieve this?</p>

Frendom
<p>Simple, just add 2 more queries</p>
<blockquote>
<p>if you don't know where to add, below Metrics Browser and Options tab you
can find + symbol to add more queries</p>
<p>and <code>container_cpu_usage_seconds_total</code> this metrics is a counter and
this will give you the CPU Usage in Cores.</p>
</blockquote>
<p><code>kube_pod_container_resource_requests{pod=~&quot;MY_POD&quot;}</code> and <code>kube_pod_container_resource_limits{pod=~&quot;MY_POD&quot;}</code>. If it's only one Pod means no issues. But if you're having mutliple Pods means try to use <code>Sum</code></p>
<ul>
<li>Query A: <code>sum(rate(container_cpu_usage_seconds_total{pod=~&quot;MY_POD&quot;}[5m]))</code></li>
<li>Query B: <code>sum(kube_pod_container_resource_requests{pod=~&quot;MY_POD&quot;})</code></li>
<li>Query C: <code>sum(kube_pod_container_resource_limits{pod=~&quot;MY_POD&quot;})</code></li>
</ul>
<p>This will looks good without too much details, for more details like container wise data just create three more Panel for Requests, Limits and Usage by Containers and add <code>by(container)</code> after the every Query</p>
<p><strong>Another Approach:</strong></p>
<p>Create Variables for Pod and Container so that you can select the Container which you want to see and add 3 queries in single panel so that the Panel looks more Dynamic and less Noise</p>
