Skip to content

Commit 31fb08a

Browse files
authored
Merge pull request #45816 from ydFu/zh-install-kubectl-linux
[zh]Update kubectl installation instructions for Linux
2 parents 324f896 + a9e1a44 commit 31fb08a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ The following methods exist for installing kubectl on Linux:
9898

9999
下载 kubectl 校验和文件:
100100

101-
{{< tabs name="download_checksum_linux" >}}
101+
{{< tabs name="download_checksum_linux" >}}
102102
{{< tab name="x86-64" codelang="bash" >}}
103-
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
103+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
104104
{{< /tab >}}
105105
{{< tab name="ARM64" codelang="bash" >}}
106-
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl.sha256"
106+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl.sha256"
107107
{{< /tab >}}
108108
{{< /tabs >}}
109109

@@ -225,6 +225,7 @@ Or use this for detailed view of version:
225225
# 如果 `/etc/apt/keyrings` 目录不存在,则应在 curl 命令之前创建它,请阅读下面的注释。
226226
# sudo mkdir -p -m 755 /etc/apt/keyrings
227227
curl -fsSL https://pkgs.k8s.io/core:/stable:/{{< param "version" >}}/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
228+
sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg # allow unprivileged APT programs to read this keyring
228229
```
229230

230231
{{< note >}}
@@ -246,23 +247,22 @@ In releases older than Debian 12 and Ubuntu 22.04, folder `/etc/apt/keyrings` do
246247
```shell
247248
# This overwrites any existing configuration in /etc/apt/sources.list.d/kubernetes.list
248249
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/{{< param "version" >}}/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
250+
sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list # helps tools such as command-not-found to work correctly
249251
```
250252
-->
251253
```shell
252254
# 这会覆盖 /etc/apt/sources.list.d/kubernetes.list 中的所有现存配置
253255
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/{{< param "version" >}}/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
256+
sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list # 有助于让诸如 command-not-found 等工具正常工作
254257
```
255258

256259
{{< note >}}
257-
<!--
258-
To upgrade kubectl to another minor release, you'll need to bump the version in
259-
`/etc/apt/sources.list.d/kubernetes.list` before running `apt-get update` and
260-
`apt-get upgrade`. This procedure is described in more detail in
261-
[Changing The Kubernetes Package Repository](/docs/tasks/administer-cluster/kubeadm/change-package-repository/).
262-
-->
263-
要升级 kubectl 到别的次要版本,你需要先升级 `/etc/apt/sources.list.d/kubernetes.list` 中的版本,
264-
再运行 `apt-get update``apt-get upgrade`
265-
更详细的步骤可以在[更改 Kubernetes 软件包仓库](/zh-cn/docs/tasks/administer-cluster/kubeadm/change-package-repository/)中找到。
260+
<!--
261+
To upgrade kubectl to another minor release, you'll need to bump the version in `/etc/apt/sources.list.d/kubernetes.list` before running `apt-get update` and `apt-get upgrade`. This procedure is described in more detail in [Changing The Kubernetes Package Repository](/docs/tasks/administer-cluster/kubeadm/change-package-repository/).
262+
-->
263+
要将 kubectl 升级到别的次要版本,你需要先升级 `/etc/apt/sources.list.d/kubernetes.list` 中的版本,
264+
再运行 `apt-get update``apt-get upgrade` 命令。
265+
更详细的步骤可以在[更改 Kubernetes 软件包存储库](/zh-cn/docs/tasks/administer-cluster/kubeadm/change-package-repository/)中找到。
266266
{{< /note >}}
267267

268268
<!--

0 commit comments

Comments
 (0)