<p>From the below pods, how can we get a list of pods which have been restarted more than 2 times. How can we get in a single line query ?</p>
<pre><code>xx-5f6df977d7-4gtxj                 3/3     Running            0          6d21h
xx-5f6df977d7-4rvtg                 3/3     Running            0          6d21h
pkz-ms-profile-df9fdc4f-2nqvw       1/1     Running            0          76d
push-green-95455c5c-fmkr7           3/3     Running            3          15d
spice-blue-77b7869847-6md6w         2/2     Running            0          19d
bang-blue-55845b9c68-ht5s5             1/3     Running            2          8m50s
mum-blue-6f544cd567-m6lws                  2/2     Running            3          76d
</code></pre>

<p>Use:</p>
<pre><code>kubectl get pods | awk '{if($4&gt;2)print$1}'
</code></pre>
<p>Use <code>-n &quot;NameSpace&quot;</code> if required to fetch pods on the basis of a namespace.
For example:</p>
<p><code>kubectl get pods -n kube-system | awk '{if($4&gt;2)print$1}'</code></p>
<p>where $1, $4 : Depends on which column pod name is present , column on which filter is to be done respectively</p>
<p><strong>Note</strong>: <code>awk</code> will work in linux whereas</p>
