Stern - Kubernetes Log Tailer
Stern: Advanced Kubernetes Log Tailer
Stern is a powerful utility designed to streamline the process of tailing logs from Kubernetes clusters. It allows developers to specify both pod and container IDs using regular expressions, offering a flexible and efficient way to monitor application behavior. This tool is invaluable for debugging and operational insights within complex Kubernetes environments.
Installation Guide
Installing Stern on macOS is straightforward using Homebrew:
brew install stern
Usage Examples
Here are some common examples to get you started with Stern:
Tail Pod Logs
To tail logs from pods whose names start with my-pods-
in the default
namespace:
stern -n default my-pods
Filter by Container
To tail logs from the same pods but only for the web
container:
stern -n default my-pods --container web
Tail Logs from a Specific Time
To view logs from the web
container in the specified pods, starting from 1 minute ago:
stern -n default my-pods --container web --since 1m