<p>Kubernetes dashboard is able to show "current running pods / pods capacity" per node. But when I try to get the same info with <code>kubectl</code> I have to run two commands:</p>

<pre><code>kubectl describe node | grep -E (^Name:|^Non-terminated)
</code></pre>

<p>which lists "current running pod on node", and</p>

<pre><code>kubectl get nodes -o=custom-columns=NAME:.metadata.name,CAPACITY:.status.capacity.pods
</code></pre>

<p>which shows the node's capacity</p>

<p>Does anyone know how I can get the output similar to below using <strong>one command</strong> only?</p>

<pre><code>NAME     CURRENT   CAPACITY
node_1   7         15
node_2   8         15
node_3   15        15
</code></pre>

<p>Thanks in advance!</p>

alxndr
<p>There is no <strong>one command</strong> for this.</p>

<p>It is possible to write script to do that with combining those two commands.</p>

<p>Note that using integer based metrics like number of pods can be very misleading as pods can vary in how much space and cpus they consume. You might use up cpus and memory before you reach node pod count capacity.</p>

<p>You can check available resources with command: <code>kubectl top nodes</code></p>

<blockquote>
  <h3>Node capacity<a href="https://kubernetes.io/docs/concepts/architecture/nodes/#node-capacity" rel="noreferrer"></a></h3>
  
  <p>The capacity of the node (number of cpus and amount of memory) is part
  of the node object. Normally, nodes register themselves and report
  their capacity when creating the node object. If you are doing
  <a href="https://kubernetes.io/docs/concepts/architecture/nodes/#manual-node-administration" rel="noreferrer">manual node
  administration</a>,
  then you need to set node capacity when adding a node.</p>
  
  <p>The Kubernetes scheduler ensures that there are enough resources for
  all the pods on a node. It checks that the sum of the requests of
  containers on the node is no greater than the node capacity. It
  includes all containers started by the kubelet, but not containers
  started directly by the <a href="https://kubernetes.io/docs/concepts/overview/components/#node-components" rel="noreferrer">container
  runtime</a>
  nor any process running outside of the containers.</p>
</blockquote>

<p>P.S.</p>

<p>On Debian the first command had to be slightly modified to work:</p>

<pre><code>kubectl describe node | grep -E "(^Name:|^Non-terminated)"
</code></pre>
