Skip to content

Commit 5c316c2

Browse files
authored
Merge pull request #29509 from steven-my/29329-translation-for-kubectl-install
[zh] translation for kubectl install section
2 parents b05768d + 6e61a2b commit 5c316c2

File tree

4 files changed

+300
-24
lines changed

4 files changed

+300
-24
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: "kubectl-convert 概述"
3+
description: >-
4+
一个 kubectl 插件,允许你将清单从一个 Kubernetes API 版本转换到不同的版本。
5+
headless: true
6+
---
7+
<!--
8+
---
9+
title: "kubectl-convert overview"
10+
description: >-
11+
A kubectl plugin that allows you to convert manifests from one version
12+
of a Kubernetes API to a different version.
13+
headless: true
14+
---
15+
-->
16+
17+
<!--
18+
A plugin for Kubernetes command-line tool `kubectl`, which allows you to convert manifests between different API
19+
versions. This can be particularly helpful to migrate manifests to a non-deprecated api version with newer Kubernetes release.
20+
For more info, visit [migrate to non deprecated apis](/docs/reference/using-api/deprecation-guide/#migrate-to-non-deprecated-apis)
21+
-->
22+
一个 Kubernetes 命令行工具 `kubectl` 的插件,允许你将清单在不同 API 版本间转换。
23+
在将清单迁移到具有较新 Kubernetes 版本的未弃用 API 版本时,这个插件特别有用。
24+
更多信息请访问 [迁移到非弃用 API](/zh/docs/reference/using-api/deprecation-guide/#migrate-to-non-deprecated-apis)

content/zh/docs/tasks/tools/install-kubectl-linux.md

Lines changed: 88 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,10 @@ The following methods exist for installing kubectl on Linux:
4444
- [Install kubectl binary with curl on Linux](#install-kubectl-binary-with-curl-on-linux)
4545
- [Install using native package management](#install-using-native-package-management)
4646
- [Install using other package management](#install-using-other-package-management)
47-
- [Install on Linux as part of the Google Cloud SDK](#install-on-linux-as-part-of-the-google-cloud-sdk)
4847
-->
4948
- [用 curl 在 Linux 系统中安装 kubectl](#install-kubectl-binary-with-curl-on-linux)
5049
- [用原生包管理工具安装](#install-using-native-package-management)
5150
- [用其他包管理工具安装](#install-using-other-package-management)
52-
- [作为谷歌云 SDK 的一部分,在 Linux 中安装](#install-on-linux-as-part-of-the-google-cloud-sdk)
5351

5452
<!--
5553
### Install kubectl binary with curl on Linux
@@ -145,6 +143,7 @@ The following methods exist for installing kubectl on Linux:
145143
即使你没有目标系统的 root 权限,仍然可以将 kubectl 安装到目录 `~/.local/bin` 中:
146144

147145
```bash
146+
chmod +x kubectl
148147
mkdir -p ~/.local/bin/kubectl
149148
mv ./kubectl ~/.local/bin/kubectl
150149
# 之后将 ~/.local/bin/kubectl 添加到 $PATH
@@ -260,13 +259,6 @@ kubectl version --client
260259

261260
{{< /tabs >}}
262261

263-
<!--
264-
### Install on Linux as part of the Google Cloud SDK
265-
-->
266-
### 作为谷歌云 SDK 的一部分,在 Linux 上安装 {#install-on-linux-as-part-of-the-google-cloud-sdk}
267-
268-
{{< include "included/install-kubectl-gcloud.md" >}}
269-
270262
<!--
271263
## Verify kubectl configuration
272264
-->
@@ -275,11 +267,11 @@ kubectl version --client
275267
{{< include "included/verify-kubectl.md" >}}
276268

277269
<!--
278-
## Optional kubectl configurations
270+
## Optional kubectl configurations and plugins
279271
280272
### Enable shell autocompletion
281273
-->
282-
## kubectl 的可选配置 {#optional-kubectl-configurations}
274+
## kubectl 的可选配置和插件 {#optional-kubectl-configurations}
283275

284276
### 启用 shell 自动补全功能 {#enable-shell-autocompletion}
285277

@@ -297,6 +289,91 @@ kubectl 为 Bash 和 Zsh 提供自动补全功能,可以减轻许多输入的
297289
{{< tab name="Zsh" include="included/optional-kubectl-configs-zsh.md" />}}
298290
{{< /tabs >}}
299291

292+
<!--
293+
### Install `kubectl convert` plugin
294+
-->
295+
### 安装 `kubectl convert` 插件
296+
297+
{{< include "included/kubectl-convert-overview.md" >}}
298+
299+
<!--
300+
1. Download the latest release with the command:
301+
-->
302+
1. 用以下命令下载最新发行版:
303+
304+
```bash
305+
curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert
306+
```
307+
<!--
308+
1. Validate the binary (optional)
309+
310+
Download the kubectl-convert checksum file:
311+
-->
312+
1. 验证该可执行文件(可选步骤)
313+
314+
下载 kubectl-convert 校验和文件:
315+
316+
```bash
317+
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert.sha256"
318+
```
319+
320+
<!--
321+
Validate the kubectl-convert binary against the checksum file:
322+
-->
323+
基于校验和,验证 kubectl-convert 的可执行文件:
324+
325+
```bash
326+
echo "$(<kubectl-convert.sha256) kubectl-convert" | sha256sum --check
327+
```
328+
329+
<!--
330+
If valid, the output is:
331+
-->
332+
验证通过时,输出为:
333+
334+
```console
335+
kubectl-convert: OK
336+
```
337+
338+
<!--
339+
If the check fails, `sha256` exits with nonzero status and prints output similar to:
340+
-->
341+
验证失败时,`sha256` 将以非零值退出,并打印输出类似于:
342+
343+
```bash
344+
kubectl-convert: FAILED
345+
sha256sum: WARNING: 1 computed checksum did NOT match
346+
```
347+
{{< note >}}
348+
<!--
349+
Download the same version of the binary and checksum.
350+
-->
351+
下载相同版本的可执行文件和校验和。
352+
{{< /note >}}
353+
354+
<!--
355+
1. Install kubectl-convert
356+
-->
357+
1. 安装 kubectl-convert
358+
359+
```bash
360+
sudo install -o root -g root -m 0755 kubectl-convert /usr/local/bin/kubectl-convert
361+
```
362+
363+
<!--
364+
1. Verify plugin is successfully installed
365+
-->
366+
1. 验证插件是否安装成功
367+
368+
```shell
369+
kubectl convert --help
370+
```
371+
372+
<!--
373+
If you do not see an error, it means the plugin is successfully installed.
374+
-->
375+
如果你没有看到任何错误就代表插件安装成功了。
376+
300377
## {{% heading "whatsnext" %}}
301378

302379
{{< include "included/kubectl-whats-next.md" >}}

content/zh/docs/tasks/tools/install-kubectl-macos.md

Lines changed: 116 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,11 @@ If you are on macOS and using [Macports](https://macports.org/) package manager,
264264
{{< include "included/verify-kubectl.md" >}}
265265

266266
<!--
267-
## Optional kubectl configurations {#optional-kubectl-configurations}
267+
## Optional kubectl configurations and plugins {#optional-kubectl-configurations}
268268
269269
### Enable shell autocompletion {#enable-shell-autocompletion}
270270
-->
271-
## 可选的 kubectl 配置 {#optional-kubectl-configurations}
271+
## 可选的 kubectl 配置和插件 {#optional-kubectl-configurations-and-plugins}
272272

273273
### 启用 shell 自动补全功能 {#enable-shell-autocompletion}
274274

@@ -286,6 +286,120 @@ kubectl 为 Bash 和 Zsh 提供自动补全功能,这可以节省许多输入
286286
{{< tab name="Zsh" include="included/optional-kubectl-configs-zsh.md" />}}
287287
{{< /tabs >}}
288288

289+
<!--
290+
### Install `kubectl convert` plugin
291+
-->
292+
### 安装 `kubectl convert` 插件
293+
294+
{{< include "included/kubectl-convert-overview.md" >}}
295+
296+
<!--
297+
1. Download the latest release with the command:
298+
-->
299+
1. 用以下命令下载最新发行版:
300+
301+
{{< tabs name="download_convert_binary_macos" >}}
302+
{{< tab name="Intel" codelang="bash" >}}
303+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert"
304+
{{< /tab >}}
305+
{{< tab name="Apple Silicon" codelang="bash" >}}
306+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert"
307+
{{< /tab >}}
308+
{{< /tabs >}}
309+
310+
<!--
311+
1. Validate the binary (optional)
312+
313+
Download the kubectl-convert checksum file:
314+
-->
315+
1. 验证该可执行文件(可选步骤)
316+
317+
下载 kubectl-convert 校验和文件:
318+
319+
{{< tabs name="download_convert_checksum_macos" >}}
320+
{{< tab name="Intel" codelang="bash" >}}
321+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert.sha256"
322+
{{< /tab >}}
323+
{{< tab name="Apple Silicon" codelang="bash" >}}
324+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert.sha256"
325+
{{< /tab >}}
326+
{{< /tabs >}}
327+
328+
<!--
329+
Validate the kubectl-convert binary against the checksum file:
330+
-->
331+
基于校验和,验证 kubectl-convert 的可执行文件:
332+
333+
```bash
334+
echo "$(<kubectl-convert.sha256) kubectl-convert" | shasum -a 256 --check
335+
```
336+
337+
<!--
338+
If valid, the output is:
339+
-->
340+
验证通过时,输出为:
341+
342+
```console
343+
kubectl-convert: OK
344+
```
345+
346+
<!--
347+
If the check fails, `shasum` exits with nonzero status and prints output similar to:
348+
-->
349+
验证失败时,`sha256` 将以非零值退出,并打印输出类似于:
350+
351+
```bash
352+
kubectl-convert: FAILED
353+
shasum: WARNING: 1 computed checksum did NOT match
354+
```
355+
356+
{{< note >}}
357+
<!--
358+
Download the same version of the binary and checksum.
359+
-->
360+
下载相同版本的可执行文件和校验和。
361+
{{< /note >}}
362+
363+
<!--
364+
1. Make kubectl-convert binary executable
365+
-->
366+
1. 使 kubectl-convert 二进制文件可执行
367+
368+
```bash
369+
chmod +x ./kubectl-convert
370+
```
371+
372+
<!--
373+
1. Move the kubectl-convert binary to a file location on your system `PATH`.
374+
-->
375+
1. 将 kubectl-convert 可执行文件移动到系统 `PATH` 环境变量中的一个位置。
376+
377+
```bash
378+
sudo mv ./kubectl-convert /usr/local/bin/kubectl-convert
379+
sudo chown root: /usr/local/bin/kubectl-convert
380+
```
381+
382+
{{< note >}}
383+
<!--
384+
Make sure `/usr/local/bin` is in your PATH environment variable.
385+
-->
386+
确保你的 PATH 环境变量中存在 `/usr/local/bin`
387+
{{< /note >}}
388+
389+
<!--
390+
1. Verify plugin is successfully installed
391+
-->
392+
1. 验证插件是否安装成功
393+
394+
```shell
395+
kubectl convert --help
396+
```
397+
398+
<!--
399+
If you do not see an error, it means the plugin is successfully installed.
400+
-->
401+
如果你没有看到任何错误就代表插件安装成功了。
402+
289403
## {{% heading "whatsnext" %}}
290404

291405
{{< include "included/kubectl-whats-next.md" >}}

0 commit comments

Comments
 (0)