Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[zh] translation for kubectl install section #29509

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions content/zh/docs/tasks/tools/included/kubectl-convert-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: "kubectl-convert 概述"
description: >-
一个 kubectl 插件,允许你将清单从一个 Kubernetes API 版本转换到不同的版本。
headless: true
---
<!--
---
title: "kubectl-convert overview"
description: >-
A kubectl plugin that allows you to convert manifests from one version
of a Kubernetes API to a different version.
headless: true
---
-->

<!--
A plugin for Kubernetes command-line tool `kubectl`, which allows you to convert manifests between different API
versions. This can be particularly helpful to migrate manifests to a non-deprecated api version with newer Kubernetes release.
For more info, visit [migrate to non deprecated apis](/docs/reference/using-api/deprecation-guide/#migrate-to-non-deprecated-apis)
-->
一个 Kubernetes 命令行工具 `kubectl` 的插件,允许你将清单在不同 API 版本间转换。
在将清单迁移到具有较新 Kubernetes 版本的未弃用 API 版本时,这个插件特别有用。
更多信息请访问 [迁移到非弃用 API](/zh/docs/reference/using-api/deprecation-guide/#migrate-to-non-deprecated-apis)
99 changes: 88 additions & 11 deletions content/zh/docs/tasks/tools/install-kubectl-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ The following methods exist for installing kubectl on Linux:
- [Install kubectl binary with curl on Linux](#install-kubectl-binary-with-curl-on-linux)
- [Install using native package management](#install-using-native-package-management)
- [Install using other package management](#install-using-other-package-management)
- [Install on Linux as part of the Google Cloud SDK](#install-on-linux-as-part-of-the-google-cloud-sdk)
-->
- [用 curl 在 Linux 系统中安装 kubectl](#install-kubectl-binary-with-curl-on-linux)
- [用原生包管理工具安装](#install-using-native-package-management)
- [用其他包管理工具安装](#install-using-other-package-management)
- [作为谷歌云 SDK 的一部分,在 Linux 中安装](#install-on-linux-as-part-of-the-google-cloud-sdk)

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

```bash
chmod +x kubectl
mkdir -p ~/.local/bin/kubectl
mv ./kubectl ~/.local/bin/kubectl
# 之后将 ~/.local/bin/kubectl 添加到 $PATH
Expand Down Expand Up @@ -260,13 +259,6 @@ kubectl version --client

{{< /tabs >}}

<!--
### Install on Linux as part of the Google Cloud SDK
-->
### 作为谷歌云 SDK 的一部分,在 Linux 上安装 {#install-on-linux-as-part-of-the-google-cloud-sdk}

{{< include "included/install-kubectl-gcloud.md" >}}

<!--
## Verify kubectl configuration
-->
Expand All @@ -275,11 +267,11 @@ kubectl version --client
{{< include "included/verify-kubectl.md" >}}

<!--
## Optional kubectl configurations
## Optional kubectl configurations and plugins

### Enable shell autocompletion
-->
## kubectl 的可选配置 {#optional-kubectl-configurations}
## kubectl 的可选配置和插件 {#optional-kubectl-configurations}

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

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

<!--
### Install `kubectl convert` plugin
-->
### 安装 `kubectl convert` 插件

{{< include "included/kubectl-convert-overview.md" >}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is blocking the CI. We don't have the file yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I remove this line from doc?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. That file should be copied from the English upstream and translated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I copied this file from en to zh and translated it.


<!--
1. Download the latest release with the command:
-->
1. 用以下命令下载最新发行版:

```bash
curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert
```
<!--
1. Validate the binary (optional)

Download the kubectl-convert checksum file:
-->
1. 验证该可执行文件(可选步骤)

下载 kubectl-convert 校验和文件:

```bash
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert.sha256"
```

<!--
Validate the kubectl-convert binary against the checksum file:
-->
基于校验和,验证 kubectl-convert 的可执行文件:

```bash
echo "$(<kubectl-convert.sha256) kubectl-convert" | sha256sum --check
```

<!--
If valid, the output is:
-->
验证通过时,输出为:

```console
kubectl-convert: OK
```

<!--
If the check fails, `sha256` exits with nonzero status and prints output similar to:
-->
验证失败时,`sha256` 将以非零值退出,并打印输出类似于:

```bash
kubectl-convert: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
```
{{< note >}}
<!--
Download the same version of the binary and checksum.
-->
下载相同版本的可执行文件和校验和。
{{< /note >}}

<!--
1. Install kubectl-convert
-->
1. 安装 kubectl-convert

```bash
sudo install -o root -g root -m 0755 kubectl-convert /usr/local/bin/kubectl-convert
```

<!--
1. Verify plugin is successfully installed
-->
1. 验证插件是否安装成功

```shell
kubectl convert --help
```

<!--
If you do not see an error, it means the plugin is successfully installed.
-->
如果你没有看到任何错误就代表插件安装成功了。

## {{% heading "whatsnext" %}}

{{< include "included/kubectl-whats-next.md" >}}
Expand Down
118 changes: 116 additions & 2 deletions content/zh/docs/tasks/tools/install-kubectl-macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ If you are on macOS and using [Macports](https://macports.org/) package manager,
{{< include "included/verify-kubectl.md" >}}

<!--
## Optional kubectl configurations {#optional-kubectl-configurations}
## Optional kubectl configurations and plugins {#optional-kubectl-configurations}

### Enable shell autocompletion {#enable-shell-autocompletion}
-->
## 可选的 kubectl 配置 {#optional-kubectl-configurations}
## 可选的 kubectl 配置和插件 {#optional-kubectl-configurations-and-plugins}

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

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

<!--
### Install `kubectl convert` plugin
-->
### 安装 `kubectl convert` 插件

{{< include "included/kubectl-convert-overview.md" >}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

拷贝并翻译了这个文件


<!--
1. Download the latest release with the command:
-->
1. 用以下命令下载最新发行版:

{{< tabs name="download_convert_binary_macos" >}}
{{< tab name="Intel" codelang="bash" >}}
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert"
{{< /tab >}}
{{< tab name="Apple Silicon" codelang="bash" >}}
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert"
{{< /tab >}}
{{< /tabs >}}

<!--
1. Validate the binary (optional)

Download the kubectl-convert checksum file:
-->
1. 验证该可执行文件(可选步骤)

下载 kubectl-convert 校验和文件:

{{< tabs name="download_convert_checksum_macos" >}}
{{< tab name="Intel" codelang="bash" >}}
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert.sha256"
{{< /tab >}}
{{< tab name="Apple Silicon" codelang="bash" >}}
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert.sha256"
{{< /tab >}}
{{< /tabs >}}

<!--
Validate the kubectl-convert binary against the checksum file:
-->
基于校验和,验证 kubectl-convert 的可执行文件:

```bash
echo "$(<kubectl-convert.sha256) kubectl-convert" | shasum -a 256 --check
```

<!--
If valid, the output is:
-->
验证通过时,输出为:

```console
kubectl-convert: OK
```

<!--
If the check fails, `shasum` exits with nonzero status and prints output similar to:
-->
验证失败时,`sha256` 将以非零值退出,并打印输出类似于:

```bash
kubectl-convert: FAILED
shasum: WARNING: 1 computed checksum did NOT match
```

{{< note >}}
<!--
Download the same version of the binary and checksum.
-->
下载相同版本的可执行文件和校验和。
{{< /note >}}

<!--
1. Make kubectl-convert binary executable
-->
1. 使 kubectl-convert 二进制文件可执行

```bash
chmod +x ./kubectl-convert
```

<!--
1. Move the kubectl-convert binary to a file location on your system `PATH`.
-->
1. 将 kubectl-convert 可执行文件移动到系统 `PATH` 环境变量中的一个位置。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 将 kubectl-convert 二进制文件移动到系统 PATH 环境变量中的一个位置。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

保留了“可执行文件”


```bash
sudo mv ./kubectl-convert /usr/local/bin/kubectl-convert
sudo chown root: /usr/local/bin/kubectl-convert
```

{{< note >}}
<!--
Make sure `/usr/local/bin` is in your PATH environment variable.
-->
确保你的 PATH 环境变量中存在 `/usr/local/bin`
{{< /note >}}

<!--
1. Verify plugin is successfully installed
-->
1. 验证插件是否安装成功

```shell
kubectl convert --help
```

<!--
If you do not see an error, it means the plugin is successfully installed.
-->
如果你没有看到任何错误就代表插件安装成功了。

## {{% heading "whatsnext" %}}

{{< include "included/kubectl-whats-next.md" >}}
Expand Down
Loading