Skip to content

Commit dbde7cf

Browse files
author
Max
authored
[zh] sync page in tasks/tools (#39666)
* [zh] sync page install-kubectl-linux * update * update
1 parent cd5919f commit dbde7cf

File tree

3 files changed

+79
-27
lines changed

3 files changed

+79
-27
lines changed

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

Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ card:
2121

2222
## {{% heading "prerequisites" %}}
2323

24-
<!--
24+
<!--
2525
You must use a kubectl version that is within one minor version difference of your cluster. For example, a v{{< skew currentVersion >}} client can communicate with v{{< skew currentVersionAddMinor -1 >}}, v{{< skew currentVersionAddMinor 0 >}}, and v{{< skew currentVersionAddMinor 1 >}} control planes.
2626
Using the latest compatible version of kubectl helps avoid unforeseen issues.
2727
-->
@@ -30,12 +30,12 @@ kubectl 版本和集群版本之间的差异必须在一个小版本号内。
3030
v{{< skew currentVersionAddMinor 0 >}} 和 v{{< skew currentVersionAddMinor 1 >}} 版本的控制面通信。
3131
用最新兼容版的 kubectl 有助于避免不可预见的问题。
3232

33-
<!--
33+
<!--
3434
## Install kubectl on Linux
3535
-->
3636
## 在 Linux 系统中安装 kubectl {#install-kubectl-on-linux}
3737

38-
<!--
38+
<!--
3939
The following methods exist for installing kubectl on Linux:
4040
-->
4141
在 Linux 系统中安装 kubectl 有如下几种方法:
@@ -49,12 +49,12 @@ The following methods exist for installing kubectl on Linux:
4949
- [用原生包管理工具安装](#install-using-native-package-management)
5050
- [用其他包管理工具安装](#install-using-other-package-management)
5151

52-
<!--
52+
<!--
5353
### Install kubectl binary with curl on Linux
5454
-->
5555
### 用 curl 在 Linux 系统中安装 kubectl {#install-kubectl-binary-with-curl-on-linux}
5656

57-
<!--
57+
<!--
5858
1. Download the latest release with the command:
5959
-->
6060
1. 用以下命令下载最新发行版:
@@ -64,7 +64,7 @@ The following methods exist for installing kubectl on Linux:
6464
```
6565

6666
{{< note >}}
67-
<!--
67+
<!--
6868
To download a specific version, replace the `$(curl -L -s https://dl.k8s.io/release/stable.txt)` portion of the command with the specific version.
6969
7070
For example, to download version {{< param "fullversion" >}} on Linux, type:
@@ -79,7 +79,7 @@ The following methods exist for installing kubectl on Linux:
7979
```
8080
{{< /note >}}
8181

82-
<!--
82+
<!--
8383
1. Validate the binary (optional)
8484
8585
Download the kubectl checksum file:
@@ -92,7 +92,7 @@ The following methods exist for installing kubectl on Linux:
9292
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
9393
```
9494

95-
<!--
95+
<!--
9696
Validate the kubectl binary against the checksum file:
9797
-->
9898
基于校验和文件,验证 kubectl 的可执行文件:
@@ -101,7 +101,7 @@ The following methods exist for installing kubectl on Linux:
101101
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
102102
```
103103

104-
<!--
104+
<!--
105105
If valid, the output is:
106106
-->
107107
验证通过时,输出为:
@@ -110,7 +110,7 @@ The following methods exist for installing kubectl on Linux:
110110
kubectl: OK
111111
```
112112

113-
<!--
113+
<!--
114114
If the check fails, `sha256` exits with nonzero status and prints output similar to:
115115
-->
116116
验证失败时,`sha256` 将以非零值退出,并打印如下输出:
@@ -121,13 +121,13 @@ The following methods exist for installing kubectl on Linux:
121121
```
122122

123123
{{< note >}}
124-
<!--
124+
<!--
125125
Download the same version of the binary and checksum.
126126
-->
127127
下载的 kubectl 与校验和文件版本必须相同。
128128
{{< /note >}}
129129

130-
<!--
130+
<!--
131131
1. Install kubectl
132132
-->
133133
3. 安装 kubectl
@@ -137,7 +137,7 @@ The following methods exist for installing kubectl on Linux:
137137
```
138138

139139
{{< note >}}
140-
<!--
140+
<!--
141141
If you do not have root access on the target system, you can still install kubectl to the `~/.local/bin` directory:
142142
-->
143143
即使你没有目标系统的 root 权限,仍然可以将 kubectl 安装到目录 `~/.local/bin` 中:
@@ -150,7 +150,7 @@ The following methods exist for installing kubectl on Linux:
150150
```
151151
{{< /note >}}
152152

153-
<!--
153+
<!--
154154
1. Test to ensure the version you installed is up-to-date:
155155
Or use this for detailed view of version:
156156
-->
@@ -159,13 +159,28 @@ Or use this for detailed view of version:
159159
```bash
160160
kubectl version --client
161161
```
162-
162+
163+
{{< note >}}
164+
<!--
165+
The above command will generate a warning:
166+
-->
167+
上面的命令会产生一个警告:
168+
```
169+
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.
170+
```
171+
<!--
172+
You can ignore this warning. You are only checking the version of `kubectl` that you
173+
have installed.
174+
-->
175+
你可以忽略这个警告。你只检查你所安装的 `kubectl` 的版本。
176+
{{< /note >}}
177+
163178
或者使用如下命令来查看版本的详细信息:
164179
```cmd
165180
kubectl version --client --output=yaml
166181
```
167182

168-
<!--
183+
<!--
169184
### Install using native package management
170185
-->
171186
### 用原生包管理工具安装 {#install-using-native-package-management}
@@ -248,7 +263,7 @@ sudo yum install -y kubectl
248263
{{% /tab %}}
249264
{{< /tabs >}}
250265

251-
<!--
266+
<!--
252267
### Install using other package management
253268
-->
254269
### 用其他包管理工具安装 {#install-using-other-package-management}
@@ -286,7 +301,7 @@ kubectl version --client
286301

287302
{{< /tabs >}}
288303

289-
<!--
304+
<!--
290305
## Verify kubectl configuration
291306
-->
292307
## 验证 kubectl 配置 {#verify-kubectl-configration}
@@ -302,7 +317,7 @@ kubectl version --client
302317

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

305-
<!--
320+
<!--
306321
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell, which can save you a lot of typing.
307322
308323
Below are the procedures to set up autocompletion for Bash, Fish, and Zsh.
@@ -333,14 +348,14 @@ kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以
333348
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert"
334349
```
335350
<!--
336-
2. Validate the binary (optional)
351+
1. Validate the binary (optional)
337352
338353
Download the kubectl-convert checksum file:
339354
-->
340355
2. 验证该可执行文件(可选步骤)
341-
356+
342357
下载 kubectl-convert 校验和文件:
343-
358+
344359
```bash
345360
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert.sha256"
346361
```
@@ -358,7 +373,7 @@ kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以
358373
If valid, the output is:
359374
-->
360375
验证通过时,输出为:
361-
376+
362377
```console
363378
kubectl-convert: OK
364379
```
@@ -381,7 +396,7 @@ kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以
381396
{{< /note >}}
382397

383398
<!--
384-
3. Install kubectl-convert
399+
1. Install kubectl-convert
385400
-->
386401
3. 安装 kubectl-convert
387402

@@ -390,7 +405,7 @@ kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以
390405
```
391406

392407
<!--
393-
4. Verify plugin is successfully installed
408+
1. Verify plugin is successfully installed
394409
-->
395410
4. 验证插件是否安装成功
396411

@@ -403,6 +418,15 @@ kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以
403418
-->
404419
如果你没有看到任何错误就代表插件安装成功了。
405420

421+
<!--
422+
1. After installing the plugin, clean up the installation files:
423+
-->
424+
5. 安装插件后,清理安装文件:
425+
426+
```bash
427+
rm kubectl-convert kubectl-convert.sha256
428+
```
429+
406430
## {{% heading "whatsnext" %}}
407431

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

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,21 @@ The following methods exist for installing kubectl on macOS:
188188
kubectl version --client
189189
```
190190

191+
{{< note >}}
192+
<!--
193+
The above command will generate a warning:
194+
-->
195+
上面的命令会产生一个警告:
196+
```
197+
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.
198+
```
199+
<!--
200+
You can ignore this warning. You are only checking the version of `kubectl` that you
201+
have installed.
202+
-->
203+
你可以忽略这个警告。你只检查你所安装的 `kubectl` 的版本。
204+
{{< /note >}}
205+
191206
<!--
192207
Or use this for detailed view of version:
193208
-->
@@ -421,10 +436,9 @@ kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以
421436
1. 安装插件后,清理安装文件:
422437

423438
```bash
424-
rm kubectl kubectl.sha256
439+
rm kubectl-convert kubectl-convert.sha256
425440
```
426441

427442
## {{% heading "whatsnext" %}}
428443

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

content/zh-cn/docs/tasks/tools/install-kubectl-windows.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,20 @@ The following methods exist for installing kubectl on Windows:
122122
```cmd
123123
kubectl version --client
124124
```
125+
{{< note >}}
126+
<!--
127+
The above command will generate a warning:
128+
-->
129+
上面的命令会产生一个警告:
130+
```
131+
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.
132+
```
133+
<!--
134+
You can ignore this warning. You are only checking the version of `kubectl` that you
135+
have installed.
136+
-->
137+
你可以忽略这个警告。你只检查你所安装的 `kubectl` 的版本。
138+
{{< /note >}}
125139

126140
<!--
127141
Or use this for detailed view of version:

0 commit comments

Comments
 (0)