Cette page est affichée en anglais. Une traduction française est en cours.
SkillsApr 15, 2026·3 min de lecture

Stern — Multi-Pod Multi-Container Log Tailing for Kubernetes

The missing multi-Pod tail -f for Kubernetes. Follows every matching Pod and container with color-coded names — the first tool SREs install after kubectl.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Stern — Multi-Pod Log Tailing
Commande d'installation directe
npx -y tokrepo@latest install f3a966bd-3900-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

TL;DR
Stern tails logs from multiple Kubernetes pods and containers simultaneously with color-coded output.
§01

What it is

Stern is a CLI tool that tails logs from multiple Kubernetes pods and containers simultaneously. It shows color-coded output with pod and container names, making it easy to follow distributed application logs in real time.

Stern targets SREs, DevOps engineers, and developers debugging Kubernetes workloads. It solves the problem of running multiple kubectl logs -f commands in separate terminals by combining all matching logs into a single stream.

The project is actively maintained and suitable for both individual developers and teams looking to integrate it into their existing toolchain. Documentation and community support are available for onboarding.

§02

How it saves time or tokens

Instead of opening one terminal per pod and mentally correlating timestamps, Stern shows all matching pods in one view with color-coded prefixes. Pod selectors use regex, so you can tail all pods for a deployment with a single pattern. When pods restart or scale, Stern automatically picks up new instances without reconnecting.

§03

How to use

  1. Install Stern via Homebrew (brew install stern), Krew, or download the binary from GitHub releases.
  2. Run stern <pod-name-pattern> to tail all pods matching the pattern in the current namespace.
  3. Use flags to filter by container name, namespace, label selector, or time range.
  4. Pipe output to grep or jq for structured log filtering.
§04

Example

# Tail all pods matching 'web-api' in the production namespace
stern web-api --namespace production

# Tail specific container in pods with label selector
stern --selector app=gateway --container nginx

# Show logs from the last 10 minutes in JSON format
stern payment-service --since 10m --output json | jq '.message'

# Tail across all namespaces
stern web --all-namespaces
§05

Related on TokRepo

§06

Common pitfalls

  • Using broad regex patterns in large clusters. A pattern like .* tails every pod and overwhelms your terminal. Be specific with pod name patterns.
  • Forgetting the --since flag when debugging. Without it, Stern shows logs from pod start time, which can dump megabytes of old logs.
  • Not using --exclude to filter out health check noise. Most services log health check requests every few seconds, cluttering the output.
  • Not reading the changelog before upgrading. Breaking changes between versions can cause unexpected failures in production. Pin your version and review release notes.

Questions fréquentes

How does Stern differ from kubectl logs?+

kubectl logs follows one pod at a time and requires a separate command per container. Stern tails multiple pods matching a regex pattern with color-coded output. It also auto-detects new pods as they scale up or restart.

Does Stern work with all Kubernetes distributions?+

Yes. Stern uses the standard Kubernetes API for log streaming. It works with any conformant distribution including EKS, GKE, AKS, k3s, and minikube.

Can I filter logs by severity level?+

Stern does not parse log content natively. Pipe its output to grep for text matching or jq for JSON-structured logs. For example: `stern app --output json | jq 'select(.level == "error")'`.

Does Stern support structured log output?+

Yes. The `--output json` flag wraps each log line in a JSON envelope with pod name, container name, namespace, and timestamp. You can then process this with jq or feed it to a log aggregator.

How do I install Stern?+

On macOS use `brew install stern`. On Linux download the binary from the GitHub releases page. If you use Krew (kubectl plugin manager), run `kubectl krew install stern`.

Sources citées (3)

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires