How do I get logs from all pods of a Kubernetes replication controller?

Torsten Bronger picture Torsten Bronger · Oct 11, 2015 · Viewed 97.1k times · Source

Running kubectl logs shows me the stderr/stdout of one Kubernetes container.

How can I get the aggregated stderr/stdout of a set of pods, preferably those created by a certain replication controller?

Answer

Adrian Ng picture Adrian Ng · Jun 9, 2017

You can use labels

kubectl logs -l app=elasticsearch