Krew — Plugin Manager for kubectl
Discover, install, and manage kubectl plugins from a curated index. Krew makes extending the Kubernetes CLI as easy as brew install.
先审查再安装
这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。
npx -y tokrepo@latest install 77462c83-3974-11f1-9bc6-00163e2b0d79 --target codex先 dry-run,确认写入项后再运行此命令。
What it is
Krew is the official plugin manager for kubectl, maintained under the Kubernetes SIGs umbrella. It provides a discoverable, centrally maintained index of community-contributed kubectl plugins and handles installation, upgrades, and removal through a single CLI.
Krew is best for Kubernetes operators and developers who want to extend kubectl with context switching, log tailing, resource tree visualization, and dozens of other capabilities without manually downloading binaries.
How it saves time or tokens
Without Krew, adding a kubectl plugin means finding the right GitHub release, downloading the correct binary for your OS and architecture, placing it in your PATH, and repeating this for updates. Krew reduces all of that to kubectl krew install <plugin>. Upgrades across all installed plugins run with a single kubectl krew upgrade command.
How to use
- Install Krew following the official instructions (a self-bootstrapping kubectl plugin):
(set -x; cd "$(mktemp -d)" &&
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
ARCH="$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" && ./"${KREW}" install krew)
- Add Krew to your PATH:
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" - Search and install plugins:
kubectl krew search ctx
kubectl krew install ctx
kubectl ctx
Example
# Install popular plugins
kubectl krew install ctx # Switch contexts quickly
kubectl krew install ns # Switch namespaces
kubectl krew install neat # Clean up kubectl output
kubectl krew install tree # Show resource ownership tree
# List installed plugins
kubectl krew list
# Upgrade all plugins
kubectl krew upgrade
Related on TokRepo
- DevOps tools — broader Kubernetes and infrastructure tooling
- Automation tools — CLI automation resources
Common pitfalls
- Forgetting to add the Krew bin directory to your PATH after installation
- Not running
kubectl krew updatebefore searching, which uses a stale plugin index - Installing plugins that conflict with existing kubectl aliases or shell functions
常见问题
Krew is maintained under the Kubernetes SIGs (Special Interest Groups) umbrella. It is not bundled with kubectl by default but is the recognized plugin manager endorsed by the Kubernetes project.
The Krew index contains over 200 community-contributed plugins covering context switching, log viewing, resource management, security scanning, and more. The index is a Git repository anyone can contribute to.
Yes. Write any executable named kubectl-myplugin, create a plugin manifest YAML describing download URLs and checksums, and submit a pull request to the krew-index repository. Krew handles cross-platform distribution.
Yes. Krew supports Linux, macOS, and Windows. The installation script detects your OS and architecture automatically. On Windows, you can install via Scoop or follow the manual installation steps.
Run kubectl krew upgrade to update all installed plugins, or kubectl krew upgrade <plugin-name> to update a specific one. Run kubectl krew update first to refresh the plugin index.
引用来源 (3)
- Krew GitHub Repository— Krew is maintained under Kubernetes SIGs
- Krew Plugin Index— 200+ community-contributed plugins in the index
- Kubernetes Docs— Krew plugin development guide
讨论
相关资产
lazy.nvim — Modern Plugin Manager for Neovim
A fast and feature-rich plugin manager for Neovim that handles lazy loading, lockfiles, profiling, and automatic builds with a clean Lua-based spec format.
WinGet — Windows Package Manager by Microsoft
WinGet is the official Windows Package Manager CLI from Microsoft. It lets you discover, install, upgrade, remove, and configure applications from the command line using a curated repository of thousands of packages.
Superfile — Modern Terminal File Manager with Beautiful UI
Superfile is a modern terminal file manager written in Go with a visually appealing interface featuring multi-panel navigation, file preview, and plugin support.
Nix — Purely Functional Package Manager for Reproducible Builds
Nix is a cross-platform package manager that uses a purely functional approach to dependency management. Every package is built in isolation with pinned dependencies, enabling reproducible builds, atomic upgrades, and easy rollbacks across Linux and macOS.