<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>Finally was able to figure out the solution. This would be somewhat hacky, but I would basically use <code>--field-selector=status.phase=Running</code> and just get the name with <code>-o=name</code> flag.
My final command would be something like </p>

<pre><code>kubectl logs -f $(kubectl get pods --field-selector=status.phase=Running -o=name | awk '/asset/ {print $1;exit}')
</code></pre>

<p>Links: <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/" rel="nofollow noreferrer">Field Selectors</a></p>
