Configs2026年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.

Introduction

Krew is the package manager for kubectl plugins, maintained under the Kubernetes SIGs umbrella. It provides a discoverable index of over 200 community plugins and handles installation, upgrades, and removal through a single CLI interface.

What Krew Does

  • Installs kubectl plugins from a centrally maintained plugin index
  • Manages plugin versions with upgrade and uninstall commands
  • Cross-platform support for Linux, macOS, and Windows
  • Provides a searchable catalog of 200+ community-contributed plugins
  • Integrates seamlessly as a kubectl subcommand (kubectl krew)

Architecture Overview

Krew is a Go binary that operates as a kubectl plugin itself. It maintains a local copy of the krew-index Git repository, which contains plugin manifests describing download URLs, checksums, and platform binaries. When you run kubectl krew install, Krew fetches the binary for your OS and architecture, verifies the checksum, and places it in the kubectl plugin path.

Self-Hosting & Configuration

  • Install Krew with the official shell script or Homebrew on macOS
  • Add $HOME/.krew/bin to your PATH for kubectl to discover installed plugins
  • Run kubectl krew update to refresh the plugin index
  • Browse available plugins with kubectl krew search or the online catalog
  • Create custom plugin manifests to distribute internal tools via a private index

Key Features

  • Official Kubernetes SIG project with a curated and reviewed plugin index
  • Single command to discover, install, update, and remove plugins
  • Checksum verification ensures binary integrity on every install
  • Support for custom indexes to host private or internal plugins
  • Works alongside manually installed kubectl plugins without conflicts

Comparison with Similar Tools

  • Homebrew — General-purpose package manager; Krew is purpose-built for kubectl plugins with manifest validation
  • Manual plugin scripts — Require manual PATH setup and updates; Krew automates lifecycle management
  • asdf — Version manager for runtimes; Krew manages kubectl extensions, not language runtimes
  • Helm — Manages Kubernetes application packages; Krew manages client-side CLI plugins

FAQ

Q: Does Krew work with any kubectl distribution? A: Yes. Krew works with standard kubectl as well as distributions like k3s and microk8s that include kubectl.

Q: Can I host a private plugin index for my organization? A: Yes. Krew supports custom indexes, so you can maintain an internal repository of plugins alongside the default public index.

Q: How do I create a kubectl plugin for Krew? A: Write any executable named kubectl-yourplugin, then submit a manifest to the krew-index repo or host it in a custom index.

Q: Is Krew installed by default with kubectl? A: No. Krew is a separate install, but once added it becomes a native kubectl subcommand.

Sources

讨论

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

相关资产