<p><code>kubectl top pod --all-namespaces | sort --reverse --key 4 --numeric | head -10</code> gives top pods in a cluster. How to get top memory consuming pods per node?</p>

sidrah junaid
<p>In Ubuntu, this is the command which works for me:</p>
<p>Sort by MEMORY Usage:</p>
<p><code>kubectl get po -A -owide | grep ${NODE_NAME} | awk '{print $1, $2}' | xargs -n2 kubectl top pod --no-headers -n $1 | sort --key 3 -nr | column -t</code></p>
<p>Sort by CPU Usage:</p>
<p><code>kubectl get po -A -owide | grep ${NODE_NAME} | awk '{print $1, $2}' | xargs -n2 kubectl top pod --no-headers -n $1 | sort --key 2 -nr | column -t</code></p>
