Skip to content

Commit c9b6674

Browse files
committed
[zh-cn] resync /tasks/tools/install-kubectl-linux.md
1 parent b43d6c9 commit c9b6674

File tree

1 file changed

+58
-43
lines changed

1 file changed

+58
-43
lines changed

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

Lines changed: 58 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -171,49 +171,65 @@ Or use this for detailed view of version:
171171
### 用原生包管理工具安装 {#install-using-native-package-management}
172172

173173
{{< tabs name="kubectl_install" >}}
174-
{{% tab name="Ubuntu、Debian 或 HypriotOS" %}}
175-
176-
<!--
177-
1. Update the `apt` package index and install packages needed to use the Kubernetes `apt` repository:
178-
-->
179-
1. 更新 `apt` 包索引,并安装使用 Kubernetes `apt` 仓库所需要的包:
180-
181-
```shell
182-
sudo apt-get update
183-
sudo apt-get install -y apt-transport-https ca-certificates curl
184-
```
185-
<!--
186-
2. Download the Google Cloud public signing key:
187-
-->
188-
2. 下载 Google Cloud 公开签名秘钥:
189-
190-
```shell
191-
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
192-
```
193-
194-
<!--
195-
3. Add the Kubernetes `apt` repository:
196-
-->
197-
3. 添加 Kubernetes `apt` 仓库:
198-
199-
```shell
200-
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
201-
```
202-
203-
<!--
204-
4. Update `apt` package index with the new repository and install kubectl:
205-
-->
206-
4. 更新 `apt` 包索引,使之包含新的仓库并安装 kubectl:
207-
208-
```shell
209-
sudo apt-get update
210-
sudo apt-get install -y kubectl
211-
```
174+
{{% tab name="基于 Debian 的发行版" %}}
175+
176+
<!--
177+
1. Update the `apt` package index and install packages needed to use the Kubernetes `apt` repository:
178+
-->
179+
1. 更新 `apt` 包索引,并安装使用 Kubernetes `apt` 仓库所需要的包:
180+
181+
```shell
182+
sudo apt-get update
183+
sudo apt-get install -y ca-certificates curl
184+
```
185+
<!--
186+
If you use Debian 9 (stretch) or earlier you would also need to install `apt-transport-https`:
187+
-->
188+
{{< note >}}
189+
190+
如果你使用 Debian 9(stretch)或更早版本,则你还需要安装 `apt-transport-https`
191+
192+
```shell
193+
sudo apt-get install -y apt-transport-https
194+
```
195+
196+
{{< /note >}}
197+
198+
<!--
199+
2. Download the Google Cloud public signing key:
200+
-->
201+
202+
2. 下载 Google Cloud 公开签名秘钥:
203+
204+
```shell
205+
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
206+
```
207+
208+
<!--
209+
3. Add the Kubernetes `apt` repository:
210+
-->
211+
212+
3. 添加 Kubernetes `apt` 仓库:
213+
214+
```shell
215+
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
216+
```
217+
218+
<!--
219+
4. Update `apt` package index with the new repository and install kubectl:
220+
-->
221+
222+
4. 更新 `apt` 包索引,使之包含新的仓库并安装 kubectl:
223+
224+
```shell
225+
sudo apt-get update
226+
sudo apt-get install -y kubectl
227+
```
228+
212229
{{% /tab %}}
213230

214-
{{% tab name="基于 Red Hat 的发行版" %}}
231+
{{< tab name="基于 Red Hat 的发行版" codelang="bash" >}}
215232

216-
```shell
217233
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
218234
[kubernetes]
219235
name=Kubernetes
@@ -223,9 +239,7 @@ gpgcheck=1
223239
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
224240
EOF
225241
sudo yum install -y kubectl
226-
```
227-
228-
{{% /tab %}}
242+
{{< /tab >}}
229243
{{< /tabs >}}
230244

231245
<!--
@@ -352,6 +366,7 @@ kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以
352366
kubectl-convert: FAILED
353367
sha256sum: WARNING: 1 computed checksum did NOT match
354368
```
369+
355370
{{< note >}}
356371
<!--
357372
Download the same version of the binary and checksum.

0 commit comments

Comments
 (0)