<p>Does anyone know how to get a sorted list of pods on a given node based on their disk space consumption?</p>
<p>The command below helps me in listing pods based on a given node but my requirement is to list those pods which are causing high disk space usage as part of investigating and solving the <code>DiskPressure</code> eviction state.</p>
<pre><code>kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=&lt;NODE_NAME&gt;
</code></pre>
<p>I was able to find commands to list CPU and memory usage of nodes (ref: <a href="https://github.com/kubernetes/kubernetes/issues/17512#issuecomment-317757388" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/17512#issuecomment-317757388</a>) but nothing related to node disk usage.</p>
<pre><code>alias util='kubectl get nodes --no-headers | awk '\''{print $1}'\'' | xargs -I {} sh -c '\''echo {} ; kubectl describe node {} | grep Allocated -A 5 | grep -ve Event -ve Allocated -ve percent -ve -- ; echo '\'''

# Get CPU request total (we x20 because because each m3.large has 2 vcpus (2000m) )
alias cpualloc='util | grep % | awk '\''{print $1}'\'' | awk '\''{ sum += $1 } END { if (NR &gt; 0) { print sum/(NR*20), &quot;%\n&quot; } }'\'''

# Get mem request total (we multiply by 75 because because each m3.large has 7.5G ram )
alias memalloc='util | grep % | awk '\''{print $5}'\'' | awk '\''{ sum += $1 } END { if (NR &gt; 0) { print sum/(NR*75), &quot;%\n&quot; } }'\'''

</code></pre>

Harsha G V
<p>found an answer to my requirement - list pods disk usage running in a given node</p>
<pre><code>kubectl get --raw /api/v1/nodes/&lt;NODE_NAME&gt;/proxy/stats/summary | jq '.pods[0] | &quot;PodName: &quot;, .podRef.name, &quot;usedBytes: &quot;, .containers[].rootfs.usedBytes'
</code></pre>
<h3>Some other stats:</h3>
<p><strong>get node filesystem usage</strong></p>
<pre><code>kubectl get --raw /api/v1/nodes/&lt;NODE_NAME&gt;/proxy/stats/summary | jq '.node.fs.usedBytes'
</code></pre>
<p><strong>get node imageFs usage</strong></p>
<pre><code>kubectl get --raw /api/v1/nodes/&lt;NODE_NAME&gt;/proxy/stats/summary | jq '.node.runtime.imageFs.usedBytes'
</code></pre>
<p><strong>get node iNodes stats</strong></p>
<pre><code>kubectl get --raw /api/v1/nodes/&lt;NODE_NAME&gt;/proxy/stats/summary | jq '.node.fs.inodesFree'

kubectl get --raw /api/v1/nodes/&lt;NODE_NAME&gt;/proxy/stats/summary | jq '.node.runtime.imageFs.inodesFree'
</code></pre>
