kubectl krew¶
- ID
krew- Home page
- Version requirement
>= 0.4
- Platforms
🅱️ BSD · 🐧 Linux · 🍎 macOS · ⨂ Unix · 🪟 Windows
- Operations
installed·search·install·upgrade·upgrade_all·remove·sync- purl types
pkg:krew- CLI names (lookup order)
kubectl-krew·krew- Forced environment
NO_COLOR=1- Issues and PRs
- Source
krew is the plugin manager of kubectl (https://krew.sigs.k8s.io), installed as
the kubectl-krew binary and driven either directly or as kubectl krew.
krew list branches on whether stdout is a terminal: piped, as mpm always runs
it, it prints the sorted plugin names one per line and nothing else, while an
interactive run gets a PLUGIN/VERSION table instead. The parser below reads the
piped form, so installed plugins carry no version. That is a deliberate upstream
choice (the !isTerminal(os.Stdout) branch of cmd/krew/cmd/list.go), not a
limitation mpm can work around.
No outdated: krew compares nothing against its index short of running the
upgrade, so the operation is left undeclared and upgrade --all still works.
What mpm adds to krew¶
Through mpm, krew gains --exact and --extended search, to narrow to exact names or match descriptions.
Bigger still, mpm reaches across every manager at once: mpm installed and mpm outdated cover krew alongside every other manager you run in one table, mpm upgrade --all updates them together, and mpm sbom exports the whole machine as one bill of materials.
Every mpm command also gains --dry-run and --plan previews, cross-scheme version comparison and purl identifiers. See manager augmentations for how each one is built.
Your krew commands, in mpm¶
You already know krew: each operation maps one-to-one onto mpm, in an interface shared by every manager.
To… |
With |
With |
|---|---|---|
List what’s installed |
|
|
Search for a package |
|
|
Install a package |
|
|
Upgrade one package |
|
|
Upgrade everything |
|
|
Remove a package |
|
|
Prefix any command above with --dry-run to simulate the underlying manager calls without touching the system: the safe way to watch what mpm would do before trusting it.
Operations¶
Operation |
Supported |
Notes |
|---|---|---|
|
✓ |
|
|
||
|
||
|
✓ |
exact and extended search backfilled by |
|
✓ |
|
|
✓ |
|
|
✓ |
|
|
✓ |
|
|
✓ |
|
|
||
|
Selecting and configuring krew¶
Deselect krew for a single run with --no-krew, or persist the choice in your configuration:
[mpm]
krew = false
The arguments and environment variables listed in the box atop this page are forced on every krew call, so runs stay quiet, non-interactive and reproducible: the defaults you would set in CI anyway.
Keep it enabled but tune how mpm drives it with a per-manager override:
[mpm.managers.krew]
timeout = 900
mpm config-template krew prints every overridable attribute as a ready-to-paste block.
Recipes¶
A few jobs you would otherwise script around krew, one mpm command each:
Snapshot and clone a machine:
mpm --krew dump krew.toml, thenmpm restore krew.tomlon the next one.Export a compliance SBOM:
mpm --krew sbom(CycloneDX by default,--spdxfor SPDX).
Privilege escalation¶
mpm runs this manager as the current user and never prepends sudo by default. Flip the policy for its privileged operations with --sudo or the per-manager sudo override.
None of its operations needs root.
See privilege escalation for the full policy.
Cooldown¶
State of kubectl krew’s release-age gating, from the cooldown support table:
Status: ❌ None
A cooldown only pays off where a compromised release can be withdrawn while the clock runs, and can only be emulated where the registry dates its releases. From the retraction table:
Registry: Git-manifest indexes
Retraction: Index revert: reverting the manifest, Portfile or derivation commit withdraws the version
Publish date: ❌ only the commit date, which is client-set and trivially backdated
With --cooldown set, mpm skips this manager’s install and upgrade operations rather than run them unguarded (fail-closed); --allow-unsupported-managers opts back in.
Version probe¶
The version is probed by running:
$ kubectl-krew --version
OPTION VALUE
GitTag v0.4.4
GitCommit 343e657
IndexURI https://github.com/kubernetes-sigs/krew-index.git
BasePath /home/kev/.krew
IndexPath /home/kev/.krew/index/default
InstallPath /home/kev/.krew/store
BinPath /home/kev/.krew/bin
DetectedPlatform linux/amd64
and extracted with:
r"GitTag\s+v?(?P<version>\S+)"
Reference traces¶
Raw native outputs captured in the bundled definition: the reference mpm’s parsers were written against. If you know kubectl krew well and a transcript below looks wrong, or a newer release changed its output format, report it.
$ kubectl-krew list
access-matrix
ctx
ns
tree
$ kubectl-krew search {query}
NAME DESCRIPTION INSTALLED
access-matrix Show an RBAC access matrix for server resources yes
ktop A top-like tool for your Kubernetes clusters no
tree Show sub-resources of the Kubernetes object yes
Feed any of these through mpm and the raw output becomes one uniform table, the same shape for every manager: filter it, project columns, or export it (mpm --krew installed --output json, or csv, toml, yaml), each package carrying a purl and a version comparable across managers.
Changelog¶
7.7.0.dev0(unreleased)Add the krew kubectl plugin manager with
installed,search,install,upgrade,removeandsyncsupport. Its piped listing carries no version, which is an upstream branch on whether stdout is a terminal.