From db3ee6e7b65abae407a2f51e9a83f8fe6a095760 Mon Sep 17 00:00:00 2001 From: jiajie Date: Sun, 6 Dec 2020 23:20:34 +0800 Subject: [PATCH] Update kubectl-plugins.md update doc to match master branch --- .../tasks/extend-kubectl/kubectl-plugins.md | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/content/zh/docs/tasks/extend-kubectl/kubectl-plugins.md b/content/zh/docs/tasks/extend-kubectl/kubectl-plugins.md index 6734a0d0d5..883246e975 100644 --- a/content/zh/docs/tasks/extend-kubectl/kubectl-plugins.md +++ b/content/zh/docs/tasks/extend-kubectl/kubectl-plugins.md @@ -14,10 +14,9 @@ content_type: task --> - 本指南演示了如何为 [kubectl](/zh/docs/reference/kubectl/kubectl/) 安装和编写扩展。 通过将核心 `kubectl` 命令看作与 Kubernetes 集群交互的基本构建块, @@ -52,12 +51,12 @@ the Kubernetes SIG CLI community. Krew 是一个由 Kubernetes SIG CLI 社区维护的插件管理器。 {{< caution >}} -Krew [插件索引](https://index.krew.dev/)所维护的 kubectl 插件并未经过安全性审查。 +Krew [插件索引](https://krew.sigs.k8s.io/plugins/) 所维护的 kubectl 插件并未经过安全性审查。 你要了解安装和运行第三方插件的安全风险,因为它们本质上时是一些在你的机器上 运行的程序。 {{< /caution >}} @@ -69,6 +68,10 @@ Krew [插件索引](https://index.krew.dev/)所维护的 kubectl 插件并未经 Executing this command causes a traversal of all files in your PATH. Any files that are executable, and begin with `kubectl-` will show up *in the order in which they are present in your PATH* in this command's output. A warning will be included for any files beginning with `kubectl-` that are *not* executable. A warning will also be included for any valid plugin files that overlap each other's name. + +You can use [Krew](https://krew.dev/) to discover and install `kubectl` +plugins from a community-curated +[plugin index](https://krew.sigs.k8s.io/plugins/). --> ### 发现插件 @@ -77,6 +80,8 @@ A warning will also be included for any valid plugin files that overlap each oth 任何以 `kubectl-` 开头的文件如果`不可执行`,都将包含一个警告。 对于任何相同的有效插件文件,都将包含一个警告。 +你可以使用 [Krew](https://krew.dev/) 从社区策划中发现和安装 `kubectl` 插件。 +[插件索引](https://krew.sigs.k8s.io/plugins/) -所有参数和标记按原样传递给可执行文件: + 所有参数和标记按原样传递给可执行文件: ``` kubectl foo version @@ -274,17 +279,17 @@ Upon having found a plugin with this name, kubectl then invokes that plugin, pas # 创建一个插件 echo -e '#!/bin/bash\n\necho "My first command-line argument was $1"' > kubectl-foo-bar-baz sudo chmod +x ./kubectl-foo-bar-baz - + # 将插件放到 PATH 下完成"安装" sudo mv ./kubectl-foo-bar-baz /usr/local/bin - + # 确保 kubectl 能够识别我们的插件 kubectl plugin list ``` ``` The following kubectl-compatible plugins are available: - + /usr/local/bin/kubectl-foo-bar-baz ``` @@ -322,7 +327,7 @@ command containing dashes in its commandline invocation by using underscores (`_ # 创建文件名中包含下划线的插件 echo -e '#!/bin/bash\n\necho "I am a plugin with a dash in my name"' > ./kubectl-foo_bar sudo chmod +x ./kubectl-foo_bar - + # 将插件放到 PATH 下 sudo mv ./kubectl-foo_bar /usr/local/bin @@ -378,11 +383,11 @@ PATH=/usr/local/bin/plugins:/usr/local/bin/moreplugins kubectl plugin list ``` The following kubectl-compatible plugins are available: - + /usr/local/bin/plugins/kubectl-foo /usr/local/bin/moreplugins/kubectl-foo - warning: /usr/local/bin/moreplugins/kubectl-foo is overshadowed by a similarly named plugin: /usr/local/bin/plugins/kubectl-foo - + error: one plugin warning was found ``` @@ -469,13 +474,13 @@ kubectl plugin list ``` ``` The following kubectl-compatible plugins are available: - + test/fixtures/pkg/kubectl/plugins/kubectl-foo /usr/local/bin/kubectl-foo - warning: /usr/local/bin/kubectl-foo is overshadowed by a similarly named plugin: test/fixtures/pkg/kubectl/plugins/kubectl-foo plugins/kubectl-invalid - warning: plugins/kubectl-invalid identified as a kubectl plugin, but it is not executable - + error: 2 plugin warnings were found ``` @@ -525,7 +530,7 @@ package it, distribute it and deliver updates to your users. distribute your plugins. This way, you use a single packaging format for all target platforms (Linux, Windows, macOS etc) and deliver updates to your users. Krew also maintains a [plugin -index](https://index.krew.dev/) so that other people can +index](https://krew.sigs.k8s.io/plugins/) so that other people can discover your plugin and install it. --> ### Krew {#distributing-krew} @@ -533,7 +538,7 @@ discover your plugin and install it. [Krew](https://krew.dev/) 提供了一种对插件进行打包和分发的跨平台方式。 基于这种方式,你会在所有的目标平台(Linux、Windows、macOS 等)使用同一 种打包形式,包括为用户提供更新。 -Krew 也维护一个[插件索引(plugin index)](https://index.krew.dev/) +Krew 也维护一个[插件索引(plugin index)](https://krew.sigs.k8s.io/plugins/) 以便其他人能够发现你的插件并安装之。