<p>I started using <a href="https://k8slens.dev/" rel="noreferrer">Lens</a> and noticed that it gives you some warnings when the pods inside the nodes have limits higher than the actual capacity.
<a href="https://i.stack.imgur.com/Txase.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Txase.png" alt="A graphic visualization from Lens where you can see a warning telling that the specified limits are higher than the node capacity" /></a></p>
<p>So I tried to get this information with <em>kubectl</em> but I'm new to <em>jsonpath</em> and I just managed to get the raw info using something like this:</p>
<pre class="lang-sh prettyprint-override"><code>kubectl get pods -o=jsonpath='{.items..resources.limits}' -A
</code></pre>
<p>That produces something like this:</p>
<pre class="lang-json prettyprint-override"><code>{&quot;cpu&quot;:&quot;200m&quot;,&quot;memory&quot;:&quot;1Gi&quot;} {&quot;cpu&quot;:&quot;200m&quot;,&quot;memory&quot;:&quot;1Gi&quot;} {&quot;cpu&quot;:&quot;200m&quot;,&quot;memory&quot;:&quot;512Mi&quot;} {&quot;cpu&quot;:&quot;500m&quot;,&quot;memory&quot;:&quot;250Mi&quot;} {&quot;memory&quot;:&quot;170Mi&quot;} {&quot;memory&quot;:&quot;170Mi&quot;} {&quot;cpu&quot;:&quot;2&quot;,&quot;memory&quot;:&quot;2Gi&quot;} {&quot;cpu&quot;:&quot;2&quot;,&quot;memory&quot;:&quot;2Gi&quot;} {&quot;cpu&quot;:&quot;2&quot;,&quot;memory&quot;:&quot;2Gi&quot;} {&quot;cpu&quot;:&quot;1&quot;,&quot;memory&quot;:&quot;1Gi&quot;} {&quot;cpu&quot;:&quot;1&quot;,&quot;memory&quot;:&quot;1Gi&quot;} {&quot;cpu&quot;:&quot;2&quot;,&quot;memory&quot;:&quot;2Gi&quot;} {&quot;cpu&quot;:&quot;100m&quot;,&quot;memory&quot;:&quot;128Mi&quot;} {&quot;cpu&quot;:&quot;100m&quot;,&quot;memory&quot;:&quot;128Mi&quot;} {&quot;cpu&quot;:&quot;500m&quot;,&quot;memory&quot;:&quot;600Mi&quot;} {&quot;cpu&quot;:&quot;1&quot;,&quot;memory&quot;:&quot;1Gi&quot;} {&quot;cpu&quot;:&quot;100m&quot;,&quot;memory&quot;:&quot;25Mi&quot;} {&quot;cpu&quot;:&quot;100m&quot;,&quot;memory&quot;:&quot;25Mi&quot;}
</code></pre>
<p>So, my questions are, how can I sum all these values? Will these values be accurate or am I missing any other query? I've checked using LimitRange and the values I got seem to be correct, the results include the limits set by the LimitRange configuration.</p>

jmservera
<p>you can use a kubectl plugin to list/sort pods with cpu limits:</p>
<pre><code>kubectl resource-capacity --sort cpu.limit --util --pods
</code></pre>
<p><a href="https://github.com/robscott/kube-capacity" rel="noreferrer">https://github.com/robscott/kube-capacity</a></p>
