<p>I was looking for a way to stream the logs of all pods of a specific deployment of mine.<br />
So, some days ago I've found <a href="https://stackoverflow.com/a/56258727/12603421">this</a> SO answer giving me a magical command:</p>
<pre><code>kubectl logs -f deployment/&lt;my-deployment&gt; --all-containers=true
</code></pre>
<p>However, I've just discovered, after a lot of time debugging, that this command actually shows the logs of just one pod, and not all of the deployment.
So I went to <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#logs" rel="nofollow noreferrer">Kubectl's official documentation</a> and found nothing relevant on the topic, just the following phrase above the example that uses the deployment, as a kind of selector, for log streaming:</p>
<pre><code>  ...
  
  # Show logs from a kubelet with an expired serving certificate
  kubectl logs --insecure-skip-tls-verify-backend nginx
  
  # Return snapshot logs from first container of a job named hello
  kubectl logs job/hello
  
  # Return snapshot logs from container nginx-1 of a deployment named nginx
  kubectl logs deployment/nginx -c nginx-1

</code></pre>
<p>So why is that the first example shown says &quot;Show logs&quot; and the other two say &quot;Return snapshot logs&quot;?</p>
<p>Is it because of this &quot;snapshot&quot; that I can't retrieve logs from all the pods of the deployment?
I've searched a lot for more deep documentation on streaming logs with kubectl but couldn't find any.</p>

Teodoro
<p>To return all pod(s) log of a deployment you can use the same selector as the deployment. You can retrieve the deployment selector like this <code>kubectl get deployment &lt;name&gt; -o jsonpath='{.spec.selector}' --namespace &lt;name&gt;</code>, then you retrieve logs using the same selector <code>kubectl logs --selector &lt;key1=value1,key2=value2&gt; --namespace &lt;name&gt;</code></p>
