Skills2026年4月16日·1 分钟阅读

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 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Krew Overview
先审查命令
npx -y tokrepo@latest install 77462c83-3974-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

TL;DR
Krew is the package manager for kubectl plugins, maintained under Kubernetes SIGs with 200+ plugins.
§01

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.

§02

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.

§03

How to use

  1. 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)
  1. Add Krew to your PATH: export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
  2. Search and install plugins:
kubectl krew search ctx
kubectl krew install ctx
kubectl ctx
§04

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
§05

Related on TokRepo

§06

Common pitfalls

  • Forgetting to add the Krew bin directory to your PATH after installation
  • Not running kubectl krew update before searching, which uses a stale plugin index
  • Installing plugins that conflict with existing kubectl aliases or shell functions

常见问题

Is Krew officially part of Kubernetes?+

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.

How many plugins does Krew have?+

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.

Can I create my own Krew plugin?+

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.

Does Krew work on Windows?+

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.

How do I update plugins installed with Krew?+

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)

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产