21
21
22
22
## {{% heading "prerequisites" %}}
23
23
24
- <!--
24
+ <!--
25
25
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.
26
26
Using the latest compatible version of kubectl helps avoid unforeseen issues.
27
27
-->
@@ -30,12 +30,12 @@ kubectl 版本和集群版本之间的差异必须在一个小版本号内。
30
30
v{{< skew currentVersionAddMinor 0 >}} 和 v{{< skew currentVersionAddMinor 1 >}} 版本的控制面通信。
31
31
用最新兼容版的 kubectl 有助于避免不可预见的问题。
32
32
33
- <!--
33
+ <!--
34
34
## Install kubectl on Linux
35
35
-->
36
36
## 在 Linux 系统中安装 kubectl {#install-kubectl-on-linux}
37
37
38
- <!--
38
+ <!--
39
39
The following methods exist for installing kubectl on Linux:
40
40
-->
41
41
在 Linux 系统中安装 kubectl 有如下几种方法:
@@ -49,12 +49,12 @@ The following methods exist for installing kubectl on Linux:
49
49
- [ 用原生包管理工具安装] ( #install-using-native-package-management )
50
50
- [ 用其他包管理工具安装] ( #install-using-other-package-management )
51
51
52
- <!--
52
+ <!--
53
53
### Install kubectl binary with curl on Linux
54
54
-->
55
55
### 用 curl 在 Linux 系统中安装 kubectl {#install-kubectl-binary-with-curl-on-linux}
56
56
57
- <!--
57
+ <!--
58
58
1. Download the latest release with the command:
59
59
-->
60
60
1 . 用以下命令下载最新发行版:
@@ -64,7 +64,7 @@ The following methods exist for installing kubectl on Linux:
64
64
```
65
65
66
66
{{< note >}}
67
- <!--
67
+ <!--
68
68
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.
69
69
70
70
For example, to download version {{< param "fullversion" >}} on Linux, type:
@@ -79,7 +79,7 @@ The following methods exist for installing kubectl on Linux:
79
79
```
80
80
{{< /note >}}
81
81
82
- <!--
82
+ <!--
83
83
1. Validate the binary (optional)
84
84
85
85
Download the kubectl checksum file:
@@ -92,7 +92,7 @@ The following methods exist for installing kubectl on Linux:
92
92
curl -LO " https://dl.k8s.io/$( curl -L -s https://dl.k8s.io/release/stable.txt) /bin/linux/amd64/kubectl.sha256"
93
93
```
94
94
95
- <!--
95
+ <!--
96
96
Validate the kubectl binary against the checksum file:
97
97
-->
98
98
基于校验和文件,验证 kubectl 的可执行文件:
@@ -101,7 +101,7 @@ The following methods exist for installing kubectl on Linux:
101
101
echo " $( cat kubectl.sha256) kubectl" | sha256sum --check
102
102
```
103
103
104
- <!--
104
+ <!--
105
105
If valid, the output is:
106
106
-->
107
107
验证通过时,输出为:
@@ -110,7 +110,7 @@ The following methods exist for installing kubectl on Linux:
110
110
kubectl: OK
111
111
```
112
112
113
- <!--
113
+ <!--
114
114
If the check fails, `sha256` exits with nonzero status and prints output similar to:
115
115
-->
116
116
验证失败时,` sha256 ` 将以非零值退出,并打印如下输出:
@@ -121,13 +121,13 @@ The following methods exist for installing kubectl on Linux:
121
121
```
122
122
123
123
{{< note >}}
124
- <!--
124
+ <!--
125
125
Download the same version of the binary and checksum.
126
126
-->
127
127
下载的 kubectl 与校验和文件版本必须相同。
128
128
{{< /note >}}
129
129
130
- <!--
130
+ <!--
131
131
1. Install kubectl
132
132
-->
133
133
3 . 安装 kubectl
@@ -137,7 +137,7 @@ The following methods exist for installing kubectl on Linux:
137
137
```
138
138
139
139
{{< note >}}
140
- <!--
140
+ <!--
141
141
If you do not have root access on the target system, you can still install kubectl to the `~/.local/bin` directory:
142
142
-->
143
143
即使你没有目标系统的 root 权限,仍然可以将 kubectl 安装到目录 ` ~/.local/bin ` 中:
@@ -150,7 +150,7 @@ The following methods exist for installing kubectl on Linux:
150
150
```
151
151
{{< /note >}}
152
152
153
- <!--
153
+ <!--
154
154
1. Test to ensure the version you installed is up-to-date:
155
155
Or use this for detailed view of version:
156
156
-->
@@ -159,13 +159,28 @@ Or use this for detailed view of version:
159
159
``` bash
160
160
kubectl version --client
161
161
```
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
+
163
178
或者使用如下命令来查看版本的详细信息:
164
179
``` cmd
165
180
kubectl version --client --output=yaml
166
181
```
167
182
168
- <!--
183
+ <!--
169
184
### Install using native package management
170
185
-->
171
186
### 用原生包管理工具安装 {#install-using-native-package-management}
@@ -248,7 +263,7 @@ sudo yum install -y kubectl
248
263
{{% /tab %}}
249
264
{{< /tabs >}}
250
265
251
- <!--
266
+ <!--
252
267
### Install using other package management
253
268
-->
254
269
### 用其他包管理工具安装 {#install-using-other-package-management}
@@ -286,7 +301,7 @@ kubectl version --client
286
301
287
302
{{< /tabs >}}
288
303
289
- <!--
304
+ <!--
290
305
## Verify kubectl configuration
291
306
-->
292
307
## 验证 kubectl 配置 {#verify-kubectl-configration}
@@ -302,7 +317,7 @@ kubectl version --client
302
317
303
318
### 启用 shell 自动补全功能 {#enable-shell-autocompletion}
304
319
305
- <!--
320
+ <!--
306
321
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell, which can save you a lot of typing.
307
322
308
323
Below are the procedures to set up autocompletion for Bash, Fish, and Zsh.
@@ -333,14 +348,14 @@ kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以
333
348
curl -LO " https://dl.k8s.io/release/$( curl -L -s https://dl.k8s.io/release/stable.txt) /bin/linux/amd64/kubectl-convert"
334
349
```
335
350
<!--
336
- 2 . Validate the binary (optional)
351
+ 1 . Validate the binary (optional)
337
352
338
353
Download the kubectl-convert checksum file:
339
354
-->
340
355
2 . 验证该可执行文件(可选步骤)
341
-
356
+
342
357
下载 kubectl-convert 校验和文件:
343
-
358
+
344
359
``` bash
345
360
curl -LO " https://dl.k8s.io/$( curl -L -s https://dl.k8s.io/release/stable.txt) /bin/linux/amd64/kubectl-convert.sha256"
346
361
```
@@ -358,7 +373,7 @@ kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以
358
373
If valid, the output is:
359
374
-->
360
375
验证通过时,输出为:
361
-
376
+
362
377
``` console
363
378
kubectl-convert: OK
364
379
```
@@ -381,7 +396,7 @@ kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以
381
396
{{< /note >}}
382
397
383
398
<!--
384
- 3 . Install kubectl-convert
399
+ 1 . Install kubectl-convert
385
400
-->
386
401
3 . 安装 kubectl-convert
387
402
@@ -390,7 +405,7 @@ kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以
390
405
```
391
406
392
407
<!--
393
- 4 . Verify plugin is successfully installed
408
+ 1 . Verify plugin is successfully installed
394
409
-->
395
410
4 . 验证插件是否安装成功
396
411
@@ -403,6 +418,15 @@ kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以
403
418
-->
404
419
如果你没有看到任何错误就代表插件安装成功了。
405
420
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
+
406
430
## {{% heading "whatsnext" %}}
407
431
408
432
{{< include "included/kubectl-whats-next.md" >}}
0 commit comments