Multi-pod and container log tailing for Kubernetes
Stern is a powerful Kubernetes debugging tool that allows you to tail logs from multiple pods and containers simultaneously. Unlike the standard kubectl logs command, stern can monitor multiple pods at once using regular expressions or Kubernetes resource queries, making it invaluable for debugging distributed applications and microservices running in Kubernetes clusters.
The tool automatically color-codes output from different pods and containers, making it easy to distinguish between log streams when debugging complex applications. Stern intelligently handles pod lifecycle changes - when pods are deleted, they're automatically removed from the tail, and when new pods are added, they're automatically included. This dynamic behavior makes it perfect for monitoring deployments, rolling updates, and troubleshooting issues across multiple replicas.
Stern is designed for DevOps engineers, platform engineers, and developers who work with Kubernetes and need efficient log monitoring capabilities. It supports advanced filtering options including container state filtering, log line inclusion/exclusion patterns, field selectors, and label selectors. The tool also offers flexible output formatting with predefined templates and custom Go templates, making it suitable for both interactive debugging and programmatic log processing.
# via Homebrew
brew install stern
# via Go Install
go install github.com/stern/stern@latest
# via Kubectl Krew
kubectl krew install stern