<p>Want to have a single command to have continue streaming of logs from particular pod. Currently I have to do</p>

<ul>
<li><code>kubectl get pods</code> (lists all the running pods)</li>
<li>check for the running pod from the list and copy the pod name</li>
<li><code>kubectl logs &lt;pod name&gt; -f</code> (continuous streaming of logs from pod)</li>
</ul>

<p>Bonus points: list pods starting with certain word like, <code>kubectl get pods asset*</code>. Which would just display pods with names starting with asset</p>

Anuj
<p>You can use <a href="https://www.gnu.org/software/gawk/manual/gawk.html" rel="nofollow noreferrer">awk</a> to achieve this. You can use:</p>

<pre><code>kubectl logs -n &lt;namespace&gt; $(kubectl get pod -n &lt;namespace&gt; |  awk '/&lt;pattern&gt;/{print $1}') -f
</code></pre>

<p>Here, you can specify regex in <code>&lt;pattern&gt;</code> field. <code>print $1</code> prints only first column of matched object. In our case, it is pod name.</p>

<p>For example:</p>

<pre><code>kubectl logs -n kube-system $(kubectl get pod -n kube-system |  awk '/kube-proxy*/{print $1}') -f
</code></pre>
