kubectl 插件管理器 Krew 安装

项目说明

Krew 是一个由 Kubernetes SIG CLI 社区维护的 kubectl 命令行工具的插件管理器。类似 红帽的YUM, 开发角度理解,类似 Nodejs 的 npm。

Krew 可以用于管理 kubelet 插件,发现 kubectl 插件,并在机器上安装它们。保持安装的插件是最新的。Krew 适用于所有主要平台,例如 macOS、Linux 和 Windows。

需要说明的是,Krew 插件索引 所维护的 kubectl 插件并 未经过安全性审查。

项目地址:https://krew.sigs.k8s.io/docs/user-guide/setup/install/

离线安装

$ mkdir krew

$ wget  https://github.com/kubernetes-sigs/krew/releases/latest/download/krew-linux_amd64.tar.gz

$ tar -xvf krew-linux_amd64.tar.gz 
./LICENSE
./krew-linux_amd64

# 查看krew版本及相关路径
$ ./krew-linux_amd64 version
OPTION            VALUE
GitTag            v0.4.3
GitCommit         dbfefa5
IndexURI          https://github.com/kubernetes-sigs/krew-index.git
BasePath          /root/.krew
IndexPath         /root/.krew/index/default
InstallPath       /root/.krew/store
BinPath           /root/.krew/bin
DetectedPlatform  linux/amd64

# 添加环境变量

$ vim ~/.bashrc
...
export PATH="${PATH}:${HOME}/.krew/bin"
...

配置为 kubectl 插件

$ cp ./krew/krew-linux_amd64 /usr/local/bin/kubectl-krew

$ kubectl krew version
OPTION            VALUE
GitTag            v0.4.3
GitCommit         dbfefa5
IndexURI          https://github.com/kubernetes-sigs/krew-index.git
BasePath          /root/.krew
IndexPath         /root/.krew/index/default
InstallPath       /root/.krew/store
BinPath           /root/.krew/bin
DetectedPlatform  linux/amd64

下载插件列表,查看插件列表

$ kubectl krew update
Adding "default" plugin index from https://github.com/kubernetes-sigs/krew-index.git.
Updated the local copy of plugin index.

$ kubectl krew info
accepts 1 arg(s), received 0

$ kubectl krew search
NAME                            DESCRIPTION                                         INSTALLED
access-matrix                   Show an RBAC access matrix for server resources     no
accurate                        Manage Accurate, a multi-tenancy controller         no
advise-policy                   Suggests PodSecurityPolicies and OPA Policies f...  no
advise-psp                      Suggests PodSecurityPolicies for cluster.           no
allctx                          Run commands on contexts in your kubeconfig         no
apparmor-manager                Manage AppArmor profiles for cluster.               no
applier                         Apply 'go text/template' files on k8s.              no
assert                          Assert Kubernetes resources                         no
auth-proxy                      Authentication proxy to a pod or service            no
aws-auth                        Manage aws-auth ConfigMap                           no
azad-proxy                      Generate and handle authentication for azad-kub...  no
bd-xray                         Run Black Duck Image Scans                          no

安装抓包插件ksniff

$ kubectl krew install sniff
Updated the local copy of plugin index.
Installing plugin: sniff
Installed plugin: sniff
\
  Use this plugin:
       kubectl sniff
  Documentation:
       https://github.com/eldadru/ksniff
  Caveats:
  \
    This plugin needs the following programs:
    * wireshark (optional, used for live capture)
  /
/
WARNING: You installed plugin "sniff" from the krew-index plugin repository.
   These plugins are not audited for security by the Krew maintainers.
   Run them at your own risk.

kubectl 插件管理器 Krew 安装
http://www.qiqios.cn/2023/02/12/kubectl-插件管理器-krew-安装/
作者
一亩三分地
发布于
2023年2月12日
许可协议