stern: one query, many pods, and a flag table the build regenerates
⎈ Multi pod and container log tailing for Kubernetes -- Friendly fork of https://github.com/wercker/stern
At a glance
- What is it?
- stern is a Go log tailer for Kubernetes that treats its argument as a regular expression until it looks like a resource, then matches it exactly, and color codes every container it follows. It is a fork of the discontinued wercker/stern, and its flag reference is generated and verified by the Makefile.
- Who is it for?
- stern fits an operator who wants one stream from a fleet of pods, filtered by regex or by owning resource, without stitching several kubectl commands together. It is a poor fit if you need the hidden concurrency defaults to be visible, since --qps and --burst defer to client-go defaults and --max-log-requests resolves -1 to 50, or 5 with --no-follow, or if you want structured output without reading the templates.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository received new commits within the last day.
- What is it written in?
- Mainly Go, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- stern/stern4,924 ★ · +53
| Repository | 2026-09-23 | 2026-11-15 |
|---|---|---|
| stern/stern | 4.9k | 4.9k |
53 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The query is a regex until it looks like a resource
One argument drives everything, and it has two modes. In the first it is a regular expression, so `stern "web-\w"` follows web-backend and web-frontend but not web-123, because the trailing digits do not match. In the second it is a Kubernetes resource written as `<resource>/<name>`, which is an exact match, so `deployment/nginx` selects every pod belonging to that deployment and you never need the generated deployment id. The supported resource kinds are pod, replicationcontroller, service, daemonset, deployment, replicaset, statefulset and job. The tail is also live in both directions: a pod that is deleted is removed from the stream, and a pod that appears later is picked up without restarting the command. That is the behaviour that makes it a fleet tool rather than a single-pod tail.
The flag reference is generated, then verified
The CLI documentation in the file is bracketed by an auto-generated marker, and the Makefile carries the tooling that produces and checks it. `make update-readme` runs `go run hack/update-readme/update-readme.go ./README.md`, and `make verify-readme` runs `./hack/verify-readme.sh`. That pairing is the interesting engineering choice here: rather than maintaining thirty-plus rows by hand, the repository treats the flag table as a build artifact with a check attached.
Concurrency defaults are real but not printed
Three flags govern how hard stern talks to the API server, and two of them hide their numbers. `--max-log-requests` defaults to -1, which means the effective value is 50, or 5 when you add --no-follow. `--burst` defaults to 0, described as using the client-go default. `--qps` also defaults to 0 with the same deferral, and --burst is ignored when --qps is -1. The practical consequence is that tailing two pods and tailing two hundred pods can behave differently without any flag on the command line looking different, and the only way to see the real numbers is to set them. Anyone running this against a busy cluster during an incident should set --qps and --max-log-requests explicitly rather than discover the defaults under load.
Every container in the pod is followed unless you say otherwise
Container selection is regular expression based, and the default is to take everything. `--container`, shortened to -c, defaults to `.*`, which is why a multi-container pod streams all of its containers without per-container flags. Around that sit the exclusions and filters: `--exclude-container` (-E) drops containers by name, `--container-state` defaults to all and accepts running, waiting, terminated or a comma-separated set, `--init-containers` and `--ephemeral-containers` both default to true, and `--diff-container` (-d) switches on different colors per container. Coloring has a constraint worth knowing: `--container-colors` defaults to the values of `--pod-colors` and must match its length, so adding a color to one list without the other is a configuration error rather than a fallback.
Five install channels, and the Go module path is one of them
Building from source is a module install:
go install github.com/stern/stern@latestThe other paths cover the usual platforms: a binary release from the releases page, `brew install stern` on Linux and macOS, `kubectl krew install stern` for kubectl plugin managers, `winget install stern.stern` on Windows, and for asdf users a plugin add followed by `asdf install stern latest`. Krew gets its own tooling in the Makefile, where validate-krew-manifest is installed as a pinned tool and run against dist/krew/stern.yaml, which suggests the plugin channel is maintained rather than incidentally working. The tradeoff of having six channels is version tracking: nothing in the command line tells you which channel a machine came from, and pinning @latest is the loosest of the six options.
Output templates exist for machines, not only for eyes
Beyond coloring, `--output` (-o) selects a predefined template, and the file names five: default, raw, json, extjson and ppextjson. `--only-log-lines` drops the pod and container prefixes so the stream can be piped, and three regular expression flags decide what survives: `--include` (-i), `--exclude` (-e) and `--highlight` (-H). Color itself has an explicit switch, `--color`, with auto meaning colorize only when a tty is attached, plus always and never, and `--pod-colors` takes SGR sequences as a comma-separated list, the example being "91,92,93,94,95,96". Taken together, the flags cover the two audiences stern has: a human watching a terminal and a pipeline reading structured lines.
A distroless image, a recent Kubernetes client, pinned tools
The container image is minimal: it starts from gcr.io/distroless/static-debian13, copies the compiled binary to /usr/local/bin/ and sets it as the entrypoint, with no shell in the result. The module declares go 1.27.2 and pins the Kubernetes libraries at v0.37.1 for api, apimachinery, cli-runtime, client-go and klog/v2, so the client version lines up with a recent cluster release. Development tooling is pinned just as tightly, with the Makefile installing goreleaser v2.18.3, golangci-lint v2.15.0, validate-krew-manifest v0.5.0 and yq v4.54.1 into hack/tools/bin. Releases are v1.35.0 on 2026-10-22, v1.34.0 on 2026-05-02 and v1.33.1 on 2025-11-04, with the last push to master on 2026-10-25.
Editorial conclusion
stern fits an operator who wants one stream from a fleet of pods, filtered by regex or by owning resource, without stitching several kubectl commands together. It is a poor fit if you need the hidden concurrency defaults to be visible, since --qps and --burst defer to client-go defaults and --max-log-requests resolves -1 to 50, or 5 with --no-follow, or if you want structured output without reading the templates. Before you adopt it, check three things: whether your clusters run the Kubernetes version that matches the v0.37.1 libraries in go.mod, whether ephemeral and init containers being included by default is what you want, and whether the config file at ~/.config/stern/config.yaml is where your existing tooling expects it.
Frequently asked questions
How do I install stern?
Six ways are given: download a binary release, run `go install github.com/stern/stern@latest`, use `brew install stern`, `kubectl krew install stern` for the kubectl plugin manager, `winget install stern.stern` on Windows, or add the asdf plugin and install the latest version from there.
What does stern do with Kubernetes logs?
It tails multiple pods and multiple containers inside a pod at once, color coding each result, removes a pod from the stream when it is deleted and picks up new pods automatically as they appear. It is a friendly fork of the discontinued wercker/stern.
How do I tail every pod of a deployment with stern?
Use the resource form of the query, `<resource>/<name>`, which is an exact match, for example `deployment/nginx`. The supported kinds are pod, replicationcontroller, service, daemonset, deployment, replicaset, statefulset and job, and this avoids needing the generated deployment id.
How do I limit stern to one container in a pod?
Pass a regular expression to `--container` (-c), which defaults to `.*` and therefore follows every container. Use `--exclude-container` to drop some by name, `--container-state` to keep only running, waiting or terminated ones, and `--diff-container` (-d) to color containers differently.
Which output formats does stern support?
`--output` (-o) selects a predefined template from default, raw, json, extjson and ppextjson. `--only-log-lines` prints log lines without the prefixes, `--color` accepts auto, always or never, and `--pod-colors` takes SGR sequences as a comma-separated list such as "91,92,93,94,95,96".
Is stern still being worked on?
The repository is not archived, and the last push to master was on 2026-10-25. Releases are v1.35.0 on 2026-10-22, v1.34.0 on 2026-05-02 and v1.33.1 on 2025-11-04, and the project describes itself as a friendly fork of the discontinued wercker/stern.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/stern-stern)Star history chart for your README
[](https://hysenlabs.com/projects/stern-stern)Was this useful?