Merge pull request #35403 from windsonsea/liunxyhf

[zh-cn] resync /tasks/tools/install-kubectl-linux.md
This commit is contained in:
Kubernetes Prow Robot
2022-07-26 07:53:10 -07:00
committed by GitHub
@@ -171,49 +171,65 @@ Or use this for detailed view of version:
### 用原生包管理工具安装 {#install-using-native-package-management} ### 用原生包管理工具安装 {#install-using-native-package-management}
{{< tabs name="kubectl_install" >}} {{< tabs name="kubectl_install" >}}
{{% tab name="Ubuntu、Debian 或 HypriotOS" %}} {{% tab name="基于 Debian 的发行版" %}}
<!-- <!--
1. Update the `apt` package index and install packages needed to use the Kubernetes `apt` repository: 1. Update the `apt` package index and install packages needed to use the Kubernetes `apt` repository:
--> -->
1. 更新 `apt` 包索引,并安装使用 Kubernetes `apt` 仓库所需要的包: 1. 更新 `apt` 包索引,并安装使用 Kubernetes `apt` 仓库所需要的包:
```shell ```shell
sudo apt-get update sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl sudo apt-get install -y ca-certificates curl
``` ```
<!-- <!--
2. Download the Google Cloud public signing key: If you use Debian 9 (stretch) or earlier you would also need to install `apt-transport-https`:
--> -->
2. 下载 Google Cloud 公开签名秘钥: {{< note >}}
```shell 如果你使用 Debian 9(stretch)或更早版本,则你还需要安装 `apt-transport-https`
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
```
<!-- ```shell
3. Add the Kubernetes `apt` repository: sudo apt-get install -y apt-transport-https
--> ```
3. 添加 Kubernetes `apt` 仓库:
```shell {{< /note >}}
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
``` <!--
2. Download the Google Cloud public signing key:
-->
<!-- 2. 下载 Google Cloud 公开签名秘钥:
4. Update `apt` package index with the new repository and install kubectl:
--> ```shell
4. 更新 `apt` 包索引,使之包含新的仓库并安装 kubectl: sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
```
<!--
3. Add the Kubernetes `apt` repository:
-->
3. 添加 Kubernetes `apt` 仓库:
```shell
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
```
<!--
4. Update `apt` package index with the new repository and install kubectl:
-->
4. 更新 `apt` 包索引,使之包含新的仓库并安装 kubectl:
```shell
sudo apt-get update
sudo apt-get install -y kubectl
```
```shell
sudo apt-get update
sudo apt-get install -y kubectl
```
{{% /tab %}} {{% /tab %}}
{{% tab name="基于 Red Hat 的发行版" %}} {{< tab name="基于 Red Hat 的发行版" codelang="bash" >}}
```shell
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes] [kubernetes]
name=Kubernetes name=Kubernetes
@@ -223,9 +239,7 @@ gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF EOF
sudo yum install -y kubectl sudo yum install -y kubectl
``` {{< /tab >}}
{{% /tab %}}
{{< /tabs >}} {{< /tabs >}}
<!-- <!--
@@ -352,6 +366,7 @@ kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以
kubectl-convert: FAILED kubectl-convert: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match sha256sum: WARNING: 1 computed checksum did NOT match
``` ```
{{< note >}} {{< note >}}
<!-- <!--
Download the same version of the binary and checksum. Download the same version of the binary and checksum.