Skip to content

Commit 87aa4d6

Browse files
authored
Merge pull request #42583 from windsonsea/admgrad
[zh] sync kubeadm-upgrade.md and upgrading-linux-nodes.md
2 parents ad57e2d + 9bde031 commit 87aa4d6

File tree

2 files changed

+78
-32
lines changed

2 files changed

+78
-32
lines changed

content/zh-cn/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade.md

Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,20 @@ The upgrade workflow at high level is the following:
105105

106106
<!-- steps -->
107107

108+
<!--
109+
## Changing the package repository
110+
111+
If you're using the Kubernetes community-owned repositories, you need to change
112+
the package repository to one that contains packages for your desired Kubernetes
113+
minor version. This is explained in [Changing the Kubernetes package repository](/docs/tasks/administer-cluster/kubeadm/change-package-repository/)
114+
document.
115+
-->
116+
## 更改软件包仓库 {#changing-the-package-repository}
117+
118+
如果你使用的是 Kubernetes 社区所属的软件包仓库,
119+
你需要将软件包仓库更改为一个包含所需 Kubernetes 次要版本软件包的仓库。
120+
这一点在[更改 Kubernetes 软件包仓库](/zh-cn/docs/tasks/administer-cluster/kubeadm/change-package-repository/)文档中有详细说明。
121+
108122
<!--
109123
## Determine which version to upgrade to
110124
-->
@@ -119,11 +133,11 @@ Find the latest patch release for Kubernetes {{< skew currentVersion >}} using t
119133
{{% tab name="Ubuntu, Debian or HypriotOS" %}}
120134
<!--
121135
# Find the latest {{< skew currentVersion >}} version in the list.
122-
# It should look like {{< skew currentVersion >}}.x-00, where x is the latest patch.
136+
# It should look like {{< skew currentVersion >}}.x-*, where x is the latest patch.
123137
-->
124138
```shell
125139
# 在列表中查找最新的 {{< skew currentVersion >}} 版本
126-
# 它看起来应该是 {{< skew currentVersion >}}.x-00,其中 x 是最新的补丁版本
140+
# 它看起来应该是 {{< skew currentVersion >}}.x-*,其中 x 是最新的补丁版本
127141
apt update
128142
apt-cache madison kubeadm
129143
```
@@ -132,11 +146,11 @@ apt-cache madison kubeadm
132146
{{% tab name="CentOS, RHEL or Fedora" %}}
133147
<!--
134148
# Find the latest {{< skew currentVersion >}} version in the list.
135-
# It should look like {{< skew currentVersion >}}.x-0, where x is the latest patch.
149+
# It should look like {{< skew currentVersion >}}.x-*, where x is the latest patch.
136150
-->
137151
```shell
138152
# 在列表中查找最新的 {{< skew currentVersion >}} 版本
139-
# 它看起来应该是 {{< skew currentVersion >}}.x-0,其中 x 是最新的补丁版本
153+
# 它看起来应该是 {{< skew currentVersion >}}.x-*,其中 x 是最新的补丁版本
140154
yum list --showduplicates kubeadm --disableexcludes=kubernetes
141155
```
142156

@@ -175,24 +189,24 @@ Pick a control plane node that you wish to upgrade first. It must have the `/etc
175189
{{% tab name="Ubuntu, Debian or HypriotOS" %}}
176190

177191
<!--
178-
# replace x in {{< skew currentVersion >}}.x-00 with the latest patch version
192+
# replace x in {{< skew currentVersion >}}.x-* with the latest patch version
179193
-->
180194
```shell
181-
# 用最新的补丁版本号替换 {{< skew currentVersion >}}.x-00 中的 x
195+
# 用最新的补丁版本号替换 {{< skew currentVersion >}}.x-* 中的 x
182196
apt-mark unhold kubeadm && \
183-
apt-get update && apt-get install -y kubeadm={{< skew currentVersion >}}.x-00 && \
197+
apt-get update && apt-get install -y kubeadm='{{< skew currentVersion >}}.x-*' && \
184198
apt-mark hold kubeadm
185199
```
186200

187201
{{% /tab %}}
188202
{{% tab name="CentOS, RHEL or Fedora" %}}
189203

190204
<!--
191-
# replace x in {{< skew currentVersion >}}.x-0 with the latest patch version
205+
# replace x in {{< skew currentVersion >}}.x-* with the latest patch version
192206
-->
193207
```shell
194-
# 用最新的补丁版本号替换 {{< skew currentVersion >}}.x-0 中的 x
195-
yum install -y kubeadm-{{< skew currentVersion >}}.x-0 --disableexcludes=kubernetes
208+
# 用最新的补丁版本号替换 {{< skew currentVersion >}}.x-* 中的 x
209+
yum install -y kubeadm-'{{< skew currentVersion >}}.x-*' --disableexcludes=kubernetes
196210
```
197211

198212
{{% /tab %}}
@@ -272,6 +286,34 @@ Pick a control plane node that you wish to upgrade first. It must have the `/etc
272286
[upgrade/kubelet] Now that your control plane is upgraded, please proceed with upgrading your kubelets if you haven't already done so.
273287
```
274288

289+
{{< note >}}
290+
291+
<!--
292+
For versions earlier than v1.28, kubeadm defaulted to a mode that upgrades the addons (including CoreDNS and kube-proxy)
293+
immediately during `kubeadm upgrade apply`, regardless of whether there are other control plane instances that have not
294+
been upgraded. This may cause compatibility problems. Since v1.28, kubeadm defaults to a mode that checks whether all
295+
the control plane instances have been upgraded before starting to upgrade the addons. You must perform control plane
296+
instances upgrade sequentially or at least ensure that the last control plane instance upgrade is not started until all
297+
the other control plane instances have been upgraded completely, and the addons upgrade will be performed after the last
298+
control plane instance is upgraded. If you want to keep the old upgrade behavior, please enable the `UpgradeAddonsBeforeControlPlane`
299+
feature gate by `kubeadm upgrade apply --feature-gates=UpgradeAddonsBeforeControlPlane=true`. The Kubernetes project does
300+
not in general recommend enabling this feature gate, you should instead change your upgrade process or cluster addons so
301+
that you do not need to enable the legacy behavior. The `UpgradeAddonsBeforeControlPlane` feature gate will be removed in
302+
a future release.
303+
-->
304+
对于 v1.28 之前的版本,kubeadm 默认采用这样一种模式:在 `kubeadm upgrade apply`
305+
期间立即升级插件(包括 CoreDNS 和 kube-proxy),而不管是否还有其他尚未升级的控制平面实例。
306+
这可能会导致兼容性问题。从 v1.28 开始,kubeadm 默认采用这样一种模式:
307+
在开始升级插件之前,先检查是否已经升级所有的控制平面实例。
308+
你必须按顺序执行控制平面实例的升级,或者至少确保在所有其他控制平面实例已完成升级之前不启动最后一个控制平面实例的升级,
309+
并且在最后一个控制平面实例完成升级之后才执行插件的升级。如果你要保留旧的升级行为,可以通过
310+
`kubeadm upgrade apply --feature-gates=UpgradeAddonsBeforeControlPlane=true` 启用
311+
`UpgradeAddonsBeforeControlPlane` 特性门控。Kubernetes 项目通常不建议启用此特性门控,
312+
你应该转为更改你的升级过程或集群插件,这样你就不需要启用旧的行为。
313+
`UpgradeAddonsBeforeControlPlane` 特性门控将在后续的版本中被移除。
314+
315+
{{</ note >}}
316+
275317
<!--
276318
1. Manually upgrade your CNI provider plugin.
277319
-->
@@ -354,24 +396,24 @@ kubectl drain <node-to-drain> --ignore-daemonsets
354396
{{% tab name="Ubuntu, Debian or HypriotOS" %}}
355397

356398
<!--
357-
# replace x in {{< skew currentVersion >}}.x-00 with the latest patch version
399+
# replace x in {{< skew currentVersion >}}.x-* with the latest patch version
358400
-->
359401
```shell
360-
# 用最新的补丁版本替换 {{< skew currentVersion >}}.x-00 中的 x
402+
# 用最新的补丁版本替换 {{< skew currentVersion >}}.x-* 中的 x
361403
apt-mark unhold kubelet kubectl && \
362-
apt-get update && apt-get install -y kubelet={{< skew currentVersion >}}.x-00 kubectl={{< skew currentVersion >}}.x-00 && \
404+
apt-get update && apt-get install -y kubelet='{{< skew currentVersion >}}.x-*' kubectl='{{< skew currentVersion >}}.x-*' && \
363405
apt-mark hold kubelet kubectl
364406
```
365407

366408
{{% /tab %}}
367409
{{% tab name="CentOS, RHEL or Fedora" %}}
368410

369411
<!--
370-
# replace x in {{< skew currentVersion >}}.x-0 with the latest patch version
412+
# replace x in {{< skew currentVersion >}}.x-* with the latest patch version
371413
-->
372414
```shell
373-
# 用最新的补丁版本号替换 {{< skew currentVersion >}}.x-00 中的 x
374-
yum install -y kubelet-{{< skew currentVersion >}}.x-0 kubectl-{{< skew currentVersion >}}.x-0 --disableexcludes=kubernetes
415+
# 用最新的补丁版本号替换 {{< skew currentVersion >}}.x-* 中的 x
416+
yum install -y kubelet-'{{< skew currentVersion >}}.x-*' kubectl-'{{< skew currentVersion >}}.x-*' --disableexcludes=kubernetes
375417
```
376418

377419
{{% /tab %}}

content/zh-cn/docs/tasks/administer-cluster/kubeadm/upgrading-linux-nodes.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,25 @@ Upgrade kubeadm:
4343

4444
升级 kubeadm:
4545

46-
<!--
47-
# replace x in {{< skew currentVersion >}}.x-00 with the latest patch version
48-
# replace x in {{< skew currentVersion >}}.x-0 with the latest patch version
49-
-->
5046
{{< tabs name="k8s_install_kubeadm_worker_nodes" >}}
5147
{{% tab name="Ubuntu、Debian 或 HypriotOS" %}}
48+
<!--
49+
# replace x in {{< skew currentVersion >}}.x-* with the latest patch version
50+
-->
5251
```shell
53-
# 将 {{< skew currentVersion >}}.x-00 中的 x 替换为最新的补丁版本
52+
# 将 {{< skew currentVersion >}}.x-* 中的 x 替换为最新的补丁版本
5453
apt-mark unhold kubeadm && \
55-
apt-get update && apt-get install -y kubeadm={{< skew currentVersion >}}.x-00 && \
54+
apt-get update && apt-get install -y kubeadm='{{< skew currentVersion >}}.x-*' && \
5655
apt-mark hold kubeadm
5756
```
5857
{{% /tab %}}
5958
{{% tab name="CentOS、RHEL 或 Fedora" %}}
59+
<!--
60+
# replace x in {{< skew currentVersion >}}.x-* with the latest patch version
61+
-->
6062
```shell
61-
# 将 {{< skew currentVersion >}}.x-0 中的 x 替换为最新的补丁版本
62-
yum install -y kubeadm-{{< skew currentVersion >}}.x-0 --disableexcludes=kubernetes
63+
# 将 {{< skew currentVersion >}}.x-* 中的 x 替换为最新的补丁版本
64+
yum install -y kubeadm-'{{< skew currentVersion >}}.x-*' --disableexcludes=kubernetes
6365
```
6466
{{% /tab %}}
6567
{{< /tabs >}}
@@ -103,23 +105,25 @@ kubectl drain <node-to-drain> --ignore-daemonsets
103105

104106
1. 升级 kubelet 和 kubectl:
105107

106-
<!--
107-
# replace x in {{< skew currentVersion >}}.x-00 with the latest patch version
108-
# replace x in {{< skew currentVersion >}}.x-0 with the latest patch version
109-
-->
110108
{{< tabs name="k8s_kubelet_and_kubectl" >}}
111109
{{% tab name="Ubuntu、Debian 或 HypriotOS" %}}
110+
<!--
111+
# replace x in {{< skew currentVersion >}}.x-* with the latest patch version
112+
-->
112113
```shell
113-
# 将 {{< skew currentVersion >}}.x-00 中的 x 替换为最新的补丁版本
114+
# 将 {{< skew currentVersion >}}.x-* 中的 x 替换为最新的补丁版本
114115
apt-mark unhold kubelet kubectl && \
115-
apt-get update && apt-get install -y kubelet={{< skew currentVersion >}}.x-00 kubectl={{< skew currentVersion >}}.x-00 && \
116+
apt-get update && apt-get install -y kubelet='{{< skew currentVersion >}}.x-*' kubectl='{{< skew currentVersion >}}.x-*' && \
116117
apt-mark hold kubelet kubectl
117118
```
118119
{{% /tab %}}
119120
{{% tab name="CentOS、RHEL 或 Fedora" %}}
121+
<!--
122+
# replace x in {{< skew currentVersion >}}.x-* with the latest patch version
123+
-->
120124
```shell
121-
# 将 {{< skew currentVersion >}}.x-0 中的 x 替换为最新的补丁版本
122-
yum install -y kubelet-{{< skew currentVersion >}}.x-0 kubectl-{{< skew currentVersion >}}.x-0 --disableexcludes=kubernetes
125+
# 将 {{< skew currentVersion >}}.x-* 中的 x 替换为最新的补丁版本
126+
yum install -y kubelet-'{{< skew currentVersion >}}.x-*' kubectl-'{{< skew currentVersion >}}.x-*' --disableexcludes=kubernetes
123127
```
124128
{{% /tab %}}
125129
{{< /tabs >}}

0 commit comments

Comments
 (0)