Kubernetes Logs and Events Cheat Sheet/Read logs from pods matching a label

Aggregate logs across all containers of pods with a label.

Section: Aggregate Logs by Workload

Read logs from pods matching a label

bash
bash
kubectl logs -n <namespace> -l app=<label> --all-containers=true --prefix

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Aggregate Logs by Workload
Read logs via deployment resource
Print logs from a workload resource instead of a single pod.
OpenIn sheetbashsame section
Read logs via Job resource
Fetch logs for batch workloads using the Job resource.
OpenIn sheetbashsame section
Follow logs for matching pods
Useful during rollouts or multi-pod incidents.
OpenIn sheetbashsame section
Get pod logs
Print logs from the default container in a pod.
OpenIn sheetbash1 tag match
Read logs from kube-system pods
Aggregate logs from a system component by label.
OpenIn sheetbash1 tag match
Get logs from a named container
Required for sidecars and multi-container pods.
OpenIn sheetbash1 tag match