<p>I have to list the name of the pod which consumes highest CPU. I am close with this command.</p>

<pre><code>kubectl top pod| sed -n '2p'
</code></pre>

<p>It prints <code>pod-01 34 45Mi</code></p>

<p>How do I extract just the pod name out of this.</p>

Naxi
<p>Actually, with <code>kubectl top pods</code>, you are not getting the pod with the highest CPU, but you get the list of pods with their CPU usage. With your command you will get the first listed pod's name, not the one's with highest CPU. The command would be:</p>

<pre><code>kubectl top pod --sort-by cpu --no-headers=true | head -1 | awk '{print $1}'
</code></pre>
