explaingit

stern/stern

4,681GoAudience · ops devopsComplexity · 2/5Setup · easy

TLDR

Stern is a command-line tool that streams logs from multiple Kubernetes pods and containers simultaneously in one terminal window, with color-coded output and filters so you stop juggling separate log commands per pod.

Mindmap

mindmap
  root((stern))
    What it does
      Multi-pod log tail
      Color-coded output
      Auto-detect new pods
      Regex filtering
    Output formats
      Plain text
      JSON
      Custom template
    Install options
      Homebrew
      WinGet
      Krew
      Binary download
    Filters
      Pod name pattern
      Namespace
      Container name
      Log content regex
    Audience
      Kubernetes operators
      DevOps engineers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Tail logs from all pods in a Kubernetes deployment at once with color-coded output to tell them apart at a glance.

USE CASE 2

Filter live pod log output to lines matching a pattern while piping the rest into jq or another log processor.

USE CASE 3

Automatically pick up logs from newly started or replaced pods without restarting the watch command.

Tech stack

GoKubernetes

Getting it running

Difficulty · easy Time to first run · 5min

Requires kubectl configured with access to a Kubernetes cluster, no additional setup needed after installation.

In plain English

Stern is a command-line tool for reading log output from applications running in Kubernetes. In Kubernetes, applications run inside units called pods, and a pod can contain multiple containers. The built-in Kubernetes tools let you read logs from one container at a time, which becomes tedious when you are trying to follow what is happening across many pods at once. Stern solves this by letting you tail logs from multiple pods and containers simultaneously in a single terminal window. You identify which pods to watch by giving Stern a search pattern. This can be a regular expression matching pod names, or a reference to a Kubernetes resource like a deployment or a job, and Stern will automatically find all the pods that belong to it. If a pod is replaced or a new one starts, Stern picks it up automatically without you needing to restart the command. Each pod and container gets a different color in the output so you can tell them apart at a glance. The tool has a wide range of filtering options. You can limit output to logs matching a certain pattern, exclude lines you do not care about, filter by which containers are running or which namespace they belong to, and choose how far back in time to pull logs. Output format can be plain text, JSON, or a custom template if you need to pipe the output into another tool. Installation is available through several standard package managers including Homebrew on macOS and Linux, WinGet on Windows, Krew for Kubernetes plugin users, and asdf. You can also download a pre-built binary directly or build it from source using Go. This is a maintained community fork of an older project called wercker/stern, which was discontinued. The license and full README are in the repository.

Copy-paste prompts

Prompt 1
Using stern, show me the command to tail logs from all pods in my api deployment filtered to lines containing ERROR across all namespaces.
Prompt 2
I want to output stern logs as JSON and pipe them into jq to extract only the message field. Write the full command.
Prompt 3
Generate a stern command that watches a Kubernetes job, stops when the job finishes, and saves all output to a file.
Prompt 4
How do I install stern via Krew and set up a shell alias to tail any deployment by name with colored output?
Open on GitHub → Explain another repo

← stern on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.