<p>Is there a way to check multiple pods in one command, perhaps something like</p>
<pre><code>kubectl logs pods/pod1 pods/pod2 [container-name]
</code></pre>
<p>?</p>

zyxue
<p>The <code>kubectl logs</code> can't print logs from multiple pods specified by names.</p>
<p>Although, you can use the <code>-l, --selector=''</code> flag as a label query to filter on. e.g.:</p>
<pre><code># Return snapshot logs from all containers in pods defined by label app=nginx
kubectl logs -lapp=nginx --all-containers=true
</code></pre>
<p>If you need to print logs from multiple different pods, there are some projects that can help:</p>
<ul>
<li><a href="https://github.com/johanhaleby/kubetail" rel="nofollow noreferrer">Kubetail</a>: Bash script that enables you to aggregate (tail/follow) logs from multiple pods into one stream. This is the same as running <code>kubectl logs -f</code> but for multiple pods.</li>
<li><a href="https://github.com/eduardobaitello/kubelogs" rel="nofollow noreferrer">Kubelogs</a>: It is a bash script that uses your current <code>kubectl context</code> to interactively select namespaces and multiple pods to download logs from. It basically runs <code>kubectl logs</code> in a loop for all containers, redirecting the logs to local files.</li>
</ul>
