How do I get logs from all pods of a Kubernetes replication controller?
I've created a small bash script called kubetail
that makes this possible. For example to tail all logs for pods named "app1" you can do:
kubetail app1
You can find the script here.
You can use labels
kubectl logs -l app=elasticsearch
And you'd probably want to specify --all-containers --ignore-errors
in order to:
- Include logs from pods with multiple containers
- Continue to next pod on fatal error (e.g. logs could not be retrieved)