Skip to content

Commit a45df4e

Browse files
authored
Merge pull request #27986 from tengqm/zh-sync-task-5
[zh] Resync task files (5)
2 parents 1da4203 + 29c0554 commit a45df4e

File tree

4 files changed

+174
-161
lines changed

4 files changed

+174
-161
lines changed

content/zh/docs/tasks/tools/included/optional-kubectl-configs-bash-mac.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ description: "在 macOS 上实现 Bash 自动补全的一些可选配置。"
44
headless: true
55
---
66
<!--
7-
---
87
title: "bash auto-completion on macOS"
98
description: "Some optional configuration for bash auto-completion on macOS."
109
headless: true
11-
---
1210
-->
1311

1412
<!--
@@ -154,20 +152,23 @@ You now have to ensure that the kubectl completion script gets sourced in all yo
154152
```
155153

156154
<!--
157-
- If you installed kubectl with Homebrew (as explained [above](#install-with-homebrew-on-macos)), then the kubectl completion script should already be in `/usr/local/etc/bash_completion.d/kubectl`. In that case, you don't need to do anything.
155+
- If you installed kubectl with Homebrew (as explained [here](/docs/tasks/tools/install-kubectl-macos/#install-with-homebrew-on-macos)), then the kubectl completion script should already be in `/usr/local/etc/bash_completion.d/kubectl`. In that case, you don't need to do anything.
158156
-->
159-
- 如果你是用 Homebrew 安装的 kubectl([如上所述](#install-with-homebrew-on-macos)),
160-
那么 kubectl 补全脚本应该已经安装到目录 `/usr/local/etc/bash_completion.d/kubectl` 中了。
161-
这种情况下,你什么都不需要做。
157+
- 如果你是用 Homebrew 安装的 kubectl(如
158+
[此页面](/zh/docs/tasks/install-with-homebrew-on-macos/#install-with-homebrew-on-macos)
159+
所描述),则kubectl 补全脚本应该已经安装到目录 `/usr/local/etc/bash_completion.d/kubectl`
160+
中了。这种情况下,你什么都不需要做。
162161

163-
{{< note >}}
164-
<!--
165-
The Homebrew installation of bash-completion v2 sources all the files in the `BASH_COMPLETION_COMPAT_DIR` directory, that's why the latter two methods work.
166-
-->
167-
用 Hommbrew 安装的 bash-completion v2 会初始化 目录 `BASH_COMPLETION_COMPAT_DIR` 中的所有文件,这就是后两种方法能正常工作的原因。
168-
{{< /note >}}
162+
{{< note >}}
163+
<!--
164+
The Homebrew installation of bash-completion v2 sources all the files in the `BASH_COMPLETION_COMPAT_DIR` directory, that's why the latter two methods work.
165+
-->
166+
用 Hommbrew 安装的 bash-completion v2 会初始化 目录 `BASH_COMPLETION_COMPAT_DIR`
167+
中的所有文件,这就是后两种方法能正常工作的原因。
168+
{{< /note >}}
169169
170170
<!--
171171
In any case, after reloading your shell, kubectl completion should be working.
172172
-->
173173
总之,重新加载 shell 之后,kubectl 补全功能将立即生效。
174+

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

Lines changed: 85 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ card:
88
title: 在 Linux 系统中安装 kubectl
99
---
1010
<!--
11-
---
1211
reviewers:
1312
- mikedanese
1413
title: Install and Set Up kubectl on Linux
@@ -18,18 +17,17 @@ card:
1817
name: tasks
1918
weight: 20
2019
title: Install kubectl on Linux
21-
---
2220
-->
2321

2422
## {{% heading "prerequisites" %}}
2523

2624
<!--
27-
You must use a kubectl version that is within one minor version difference of your cluster.
28-
For example, a v1.2 client should work with v1.1, v1.2, and v1.3 master.
25+
You must use a kubectl version that is within one minor version difference of your cluster. For example, a v{{< skew latestVersion >}} client can communicate with v{{< skew prevMinorVersion >}}, v{{< skew latestVersion >}}, and v{{< skew nextMinorVersion >}} control planes.
2926
Using the latest version of kubectl helps avoid unforeseen issues.
3027
-->
3128
kubectl 版本和集群版本之间的差异必须在一个小版本号内。
32-
例如:v1.2 版本的客户端只能与 v1.1、v1.2 和 v1.3 版本的集群一起工作。
29+
例如:v{{< skew latestVersion >}} 版本的客户端能与 v{{< skew prevMinorVersion >}}、
30+
v{{< skew latestVersion >}} 和 v{{< skew nextMinorVersion >}} 版本的控制面通信。
3331
用最新版的 kubectl 有助于避免不可预见的问题。
3432

3533
<!--
@@ -42,16 +40,16 @@ The following methods exist for installing kubectl on Linux:
4240
-->
4341
在 Linux 系统中安装 kubectl 有如下几种方法:
4442

45-
- [{{% heading "prerequisites" %}}](#{{% heading "prerequisites" %}})
46-
- [在 Linux 系统中安装 kubectl](#install-kubectl-on-linux)
47-
- [用 curl 在 Linux 系统中安装 kubectl](#install-kubectl-binary-with-curl-on-linux)
48-
- [用原生包管理工具安装](#install-using-native-package-management)
49-
- [用其他包管理工具安装](#install-using-other-package-management)
50-
- [作为谷歌云 SDK 的一部分,在 Linux 中安装](#install-on-linux-as-part-of-the-google-cloud-sdk)
51-
- [验证 kubectl 配置](#verify-kubectl-configration)
52-
- [可选的 kubectl 配置](#optional-kubectl-configurations)
53-
- [启用 shell 自动补全功能](#enable-shell-autocompletion)
54-
- [{{% heading "whatsnext" %}}](#{{% heading "whatsnext" %}})
43+
<!--
44+
- [Install kubectl binary with curl on Linux](#install-kubectl-binary-with-curl-on-linux)
45+
- [Install using native package management](#install-using-native-package-management)
46+
- [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)
48+
-->
49+
- [用 curl 在 Linux 系统中安装 kubectl](#install-kubectl-binary-with-curl-on-linux)
50+
- [用原生包管理工具安装](#install-using-native-package-management)
51+
- [用其他包管理工具安装](#install-using-other-package-management)
52+
- [作为谷歌云 SDK 的一部分,在 Linux 中安装](#install-on-linux-as-part-of-the-google-cloud-sdk)
5553

5654
<!--
5755
### Install kubectl binary with curl on Linux
@@ -68,26 +66,27 @@ The following methods exist for installing kubectl on Linux:
6866
```
6967

7068
{{< note >}}
71-
<!--
72-
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+
<!--
70+
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.
7371
74-
For example, to download version {{< param "fullversion" >}} on Linux, type:
75-
-->
76-
如需下载某个指定的版本,请用指定版本号替换该命令的这一部分: `$(curl -L -s https://dl.k8s.io/release/stable.txt)`
72+
For example, to download version {{< param "fullversion" >}} on Linux, type:
73+
-->
74+
如需下载某个指定的版本,请用指定版本号替换该命令的这一部分:
75+
`$(curl -L -s https://dl.k8s.io/release/stable.txt)`
7776

78-
例如,要在 Linux 中下载 {{< param "fullversion" >}} 版本,请输入:
77+
例如,要在 Linux 中下载 {{< param "fullversion" >}} 版本,请输入:
7978

8079
```bash
8180
curl -LO https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/linux/amd64/kubectl
8281
```
8382
{{< /note >}}
8483

85-
<!--
86-
1. Validate the binary (optional)
84+
<!--
85+
1. Validate the binary (optional)
8786
88-
Download the kubectl checksum file:
89-
-->
90-
1. 验证该可执行文件(可选步骤)
87+
Download the kubectl checksum file:
88+
-->
89+
2. 验证该可执行文件(可选步骤)
9190

9291
下载 kubectl 校验和文件:
9392

@@ -130,10 +129,10 @@ For example, to download version {{< param "fullversion" >}} on Linux, type:
130129
下载的 kubectl 与校验和文件版本必须相同。
131130
{{< /note >}}
132131

133-
<!--
134-
1. Install kubectl
135-
-->
136-
1. 安装 kubectl
132+
<!--
133+
1. Install kubectl
134+
-->
135+
3. 安装 kubectl
137136

138137
```bash
139138
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
@@ -148,15 +147,14 @@ For example, to download version {{< param "fullversion" >}} on Linux, type:
148147
```bash
149148
mkdir -p ~/.local/bin/kubectl
150149
mv ./kubectl ~/.local/bin/kubectl
151-
# and then add ~/.local/bin/kubectl to $PATH
150+
# 之后将 ~/.local/bin/kubectl 添加到 $PATH
152151
```
153-
154152
{{< /note >}}
155153

156-
<!--
157-
1. Test to ensure the version you installed is up-to-date:
158-
-->
159-
1. 执行测试,以保障你安装的版本是最新的:
154+
<!--
155+
1. Test to ensure the version you installed is up-to-date:
156+
-->
157+
4. 执行测试,以保障你安装的版本是最新的:
160158

161159
```bash
162160
kubectl version --client
@@ -169,14 +167,49 @@ For example, to download version {{< param "fullversion" >}} on Linux, type:
169167

170168
{{< tabs name="kubectl_install" >}}
171169
{{< tab name="Ubuntu、Debian 或 HypriotOS" codelang="bash" >}}
172-
sudo apt-get update && sudo apt-get install -y apt-transport-https gnupg2 curl
173-
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
174-
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
175-
sudo apt-get update
176-
sudo apt-get install -y kubectl
170+
171+
<!--
172+
1. Update the `apt` package index and install packages needed to use the Kubernetes `apt` repository:
173+
-->
174+
1. 更新 `apt` 包索引,并安装使用 Kubernetes `apt` 仓库锁需要的包:
175+
176+
```shell
177+
sudo apt-get update
178+
sudo apt-get install -y apt-transport-https ca-certificates curl
179+
```
180+
181+
<!--
182+
2. Download the Google Cloud public signing key:
183+
-->
184+
2. 下载 Google Cloud 公开签名秘钥:
185+
186+
```shell
187+
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
188+
```
189+
190+
<!--
191+
3. Add the Kubernetes `apt` repository:
192+
-->
193+
3. 添加 Kubernetes `apt` 仓库:
194+
195+
```shell
196+
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
197+
```
198+
199+
<!--
200+
4. Update `apt` package index with the new repository and install kubectl:
201+
-->
202+
4. 更新 `apt` 包索引,使之包含新的仓库并安装 kubectl:
203+
204+
```shell
205+
sudo apt-get update
206+
sudo apt-get install -y kubectl
207+
```
208+
177209
{{< /tab >}}
178210

179-
{{< tab name="CentOS、RHEL 或 Fedora" codelang="bash" >}}cat <<EOF > /etc/yum.repos.d/kubernetes.repo
211+
{{< tab name="基于 Red Hat 的发行版" codelang="bash" >}}
212+
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
180213
[kubernetes]
181214
name=Kubernetes
182215
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
@@ -199,7 +232,8 @@ yum install -y kubectl
199232
<!--
200233
If you are on Ubuntu or another Linux distribution that support [snap](https://snapcraft.io/docs/core/install) package manager, kubectl is available as a [snap](https://snapcraft.io/) application.
201234
-->
202-
如果你使用的 Ubuntu 或其他 Linux 发行版,内建支持 [snap](https://snapcraft.io/docs/core/install) 包管理工具,
235+
如果你使用的 Ubuntu 或其他 Linux 发行版,内建支持
236+
[snap](https://snapcraft.io/docs/core/install) 包管理工具,
203237
则可用 [snap](https://snapcraft.io/) 命令安装 kubectl。
204238

205239
```shell
@@ -213,7 +247,8 @@ kubectl version --client
213247
<!--
214248
If you are on Linux and using [Homebrew](https://docs.brew.sh/Homebrew-on-Linux) package manager, kubectl is available for [installation](https://docs.brew.sh/Homebrew-on-Linux#install).
215249
-->
216-
如果你使用 Linux 系统,并且装了 [Homebrew](https://docs.brew.sh/Homebrew-on-Linux) 包管理工具,
250+
如果你使用 Linux 系统,并且装了 [Homebrew](https://docs.brew.sh/Homebrew-on-Linux)
251+
包管理工具,
217252
则可以使用这种方式[安装](https://docs.brew.sh/Homebrew-on-Linux#install) kubectl。
218253

219254
```shell
@@ -239,6 +274,11 @@ kubectl version --client
239274

240275
{{< include "included/verify-kubectl.md" >}}
241276

277+
<!--
278+
## Optional kubectl configurations
279+
280+
### Enable shell autocompletion
281+
-->
242282
## kubectl 的可选配置 {#optional-kubectl-configurations}
243283

244284
### 启用 shell 自动补全功能 {#enable-shell-autocompletion}
@@ -260,3 +300,4 @@ kubectl 为 Bash 和 Zsh 提供自动补全功能,可以减轻许多输入的
260300
## {{% heading "whatsnext" %}}
261301

262302
{{< include "included/kubectl-whats-next.md" >}}
303+

0 commit comments

Comments
 (0)