Skip to content

Commit a0cf6ca

Browse files
authored
Merge pull request #25421 from jiaj12/patch-37
Update kubectl-plugins.md
2 parents 5dc5ba1 + a902f96 commit a0cf6ca

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

content/zh/docs/tasks/extend-kubectl/kubectl-plugins.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ content_type: task
1414
-->
1515

1616
<!-- overview -->
17-
1817
<!--
1918
This guide demonstrates how to install and write extensions for [kubectl](/docs/reference/kubectl/kubectl/). By thinking of core `kubectl` commands as essential building blocks for interacting with a Kubernetes cluster, a cluster administrator can think
20-
of plugins as a means of utilizing these building blocks to create more complex behavior. Plugins extend `kubectl` with new sub-commands, allowing for new and custom features not included in the main distribution of `kubectl`.
19+
of plugins as a means of utilizing these building blocks to create more complex behavior. Plugins extend `kubectl` with new sub-commands, allowing for new and custom features not included in the main distribution of `kubectl`.
2120
-->
2221
本指南演示了如何为 [kubectl](/zh/docs/reference/kubectl/kubectl/) 安装和编写扩展。
2322
通过将核心 `kubectl` 命令看作与 Kubernetes 集群交互的基本构建块,
@@ -52,12 +51,12 @@ the Kubernetes SIG CLI community.
5251
Krew 是一个由 Kubernetes SIG CLI 社区维护的插件管理器。
5352

5453
<!--
55-
Kubectl plugins available via the Krew [plugin index](https://index.krew.dev/)
54+
Kubectl plugins available via the Krew [plugin index](https://krew.sigs.k8s.io/plugins/)
5655
are not audited for security. You should install and run third-party plugins at your
5756
own risk, since they are arbitrary programs running on your machine.
5857
-->
5958
{{< caution >}}
60-
Krew [插件索引](https://index.krew.dev/)所维护的 kubectl 插件并未经过安全性审查。
59+
Krew [插件索引](https://krew.sigs.k8s.io/plugins/) 所维护的 kubectl 插件并未经过安全性审查。
6160
你要了解安装和运行第三方插件的安全风险,因为它们本质上时是一些在你的机器上
6261
运行的程序。
6362
{{< /caution >}}
@@ -69,6 +68,10 @@ Krew [插件索引](https://index.krew.dev/)所维护的 kubectl 插件并未经
6968
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.
7069
A warning will be included for any files beginning with `kubectl-` that are *not* executable.
7170
A warning will also be included for any valid plugin files that overlap each other's name.
71+
72+
You can use [Krew](https://krew.dev/) to discover and install `kubectl`
73+
plugins from a community-curated
74+
[plugin index](https://krew.sigs.k8s.io/plugins/).
7275
-->
7376
### 发现插件
7477

@@ -77,6 +80,9 @@ A warning will also be included for any valid plugin files that overlap each oth
7780
任何以 `kubectl-` 开头的文件如果`不可执行`,都将包含一个警告。
7881
对于任何相同的有效插件文件,都将包含一个警告。
7982

83+
你可以使用 [Krew](https://krew.dev/) 从社区策划的[插件索引](https://krew.sigs.k8s.io/plugins/)
84+
中发现和安装 `kubectl` 插件。
85+
8086
<!--
8187
#### Limitations
8288
@@ -322,7 +328,7 @@ command containing dashes in its commandline invocation by using underscores (`_
322328
# 创建文件名中包含下划线的插件
323329
echo -e '#!/bin/bash\n\necho "I am a plugin with a dash in my name"' > ./kubectl-foo_bar
324330
sudo chmod +x ./kubectl-foo_bar
325-
331+
326332
# 将插件放到 PATH 下
327333
sudo mv ./kubectl-foo_bar /usr/local/bin
328334

@@ -378,11 +384,11 @@ PATH=/usr/local/bin/plugins:/usr/local/bin/moreplugins kubectl plugin list
378384

379385
```
380386
The following kubectl-compatible plugins are available:
381-
387+
382388
/usr/local/bin/plugins/kubectl-foo
383389
/usr/local/bin/moreplugins/kubectl-foo
384390
- warning: /usr/local/bin/moreplugins/kubectl-foo is overshadowed by a similarly named plugin: /usr/local/bin/plugins/kubectl-foo
385-
391+
386392
error: one plugin warning was found
387393
```
388394

@@ -469,7 +475,7 @@ kubectl plugin list
469475
```
470476
```
471477
The following kubectl-compatible plugins are available:
472-
478+
473479
test/fixtures/pkg/kubectl/plugins/kubectl-foo
474480
/usr/local/bin/kubectl-foo
475481
- warning: /usr/local/bin/kubectl-foo is overshadowed by a similarly named plugin: test/fixtures/pkg/kubectl/plugins/kubectl-foo
@@ -525,15 +531,15 @@ package it, distribute it and deliver updates to your users.
525531
distribute your plugins. This way, you use a single packaging format for all
526532
target platforms (Linux, Windows, macOS etc) and deliver updates to your users.
527533
Krew also maintains a [plugin
528-
index](https://index.krew.dev/) so that other people can
534+
index](https://krew.sigs.k8s.io/plugins/) so that other people can
529535
discover your plugin and install it.
530536
-->
531537
### Krew {#distributing-krew}
532538

533539
[Krew](https://krew.dev/) 提供了一种对插件进行打包和分发的跨平台方式。
534540
基于这种方式,你会在所有的目标平台(Linux、Windows、macOS 等)使用同一
535541
种打包形式,包括为用户提供更新。
536-
Krew 也维护一个[插件索引(plugin index)](https://index.krew.dev/)
542+
Krew 也维护一个[插件索引(plugin index)](https://krew.sigs.k8s.io/plugins/)
537543
以便其他人能够发现你的插件并安装之。
538544

539545
<!--
@@ -552,7 +558,7 @@ platforms for each release.
552558
另一种方式是,你可以使用传统的包管理器(例如 Linux 上 的 `apt``yum`
553559
Windows 上的 Chocolatey、macOs 上的 Homebrew)。
554560
只要能够将新的可执行文件放到用户的 `PATH` 路径上某处,这种包管理器就符合需要。
555-
作为一个插件作者,如果你选择这种方式来纷飞,你就需要自己来管理和更新
561+
作为一个插件作者,如果你选择这种方式来分发,你就需要自己来管理和更新
556562
你的 kubectl 插件的分发包,包括所有平台和所有发行版本。
557563

558564
<!--
@@ -582,4 +588,3 @@ installs easier.
582588
* 查看 CLI 插件库示例,查看用 Go 编写的插件的[详细示例](https://github.com/kubernetes/sample-cli-plugin)
583589
* 如有任何问题,请随时联系 [SIG CLI ](https://github.com/kubernetes/community/tree/master/sig-cli)
584590
* 了解 [Krew](https://krew.dev/),一个 kubectl 插件管理器。
585-

0 commit comments

Comments
 (0)