finds.dev← search

// the find

ahmetb/kubectl-foreach

★ 494 · Go · Apache-2.0 · updated Sep 2026

Run kubectl commands in all/some contexts in parallel (similar to GNU xargs+parallel)

kubectl-foreach is a kubectl plugin that runs one kubectl command against many kubeconfig contexts at once, selecting them by exact name, regular expression, or exclusion pattern. It is for operators who manage a fleet of clusters and need to read or change the same resource across all of them without writing a shell loop.

- Inclusion and exclusion share one syntax. A single argument list like `/-prod/ ^minikube` covers most fleet selection, so the common cases don't need a wrapper script.

- The `-I` placeholder rewrites arguments per context. That makes the tool usable with kubectl plugins that take the context as a flag value instead of honoring `--context`, which is a real gap in how plugins receive context.

- The FAQ shows the author hit the macOS file-descriptor limit at 50+ clusters and documented the `ulimit` workaround instead of hiding it. The `-c` flag gives a separate concurrency cap.

- It ships through Krew with a goreleaser pipeline, and argument parsing, matching, filtering, and output each have their own test file.

- Output is one prefixed line per context and unordered. The README says outright that it is not meant to be parsed, so anything past eyeballing the results means writing a different tool.

- Concurrency defaults to unlimited, so the out-of-the-box path is the one that hits the file-descriptor ceiling on larger fleets. The fix sits in the user's shell, not in the tool.

- `-q` turns off the confirmation prompt for every command, including `delete` and `apply`. Running a mutating command across a fleet from muscle memory is the case that prompt exists for, and the README mentions no dry-run option to fall back on.

- The README doesn't document exit codes or how a partial failure, such as one unreachable cluster or an expired credential, is reported. That matters the moment this runs inside a script, even though the README says not to script it.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →