[zh] Tidy up and fix links in tasks section (8/10)
This commit is contained in:
@@ -1,25 +1,26 @@
|
||||
---
|
||||
reviewers:
|
||||
- sig-cluster-lifecycle
|
||||
title: 升级 kubeadm 集群
|
||||
content_type: task
|
||||
weight: 20
|
||||
min-kubernetes-server-version: 1.18
|
||||
---
|
||||
<!--
|
||||
---
|
||||
reviewers:
|
||||
- sig-cluster-lifecycle
|
||||
title: Upgrading kubeadm clusters
|
||||
content_type: task
|
||||
---
|
||||
weight: 20
|
||||
min-kubernetes-server-version: 1.18
|
||||
-->
|
||||
|
||||
<!-- overview -->
|
||||
|
||||
<!--
|
||||
This page explains how to upgrade a Kubernetes cluster created with kubeadm from version
|
||||
1.16.x to version 1.17.x, and from version 1.17.x to 1.17.y (where `y > x`).
|
||||
1.17.x to version 1.18.x, and from version 1.18.x to 1.18.y (where `y > x`).
|
||||
-->
|
||||
本页介绍了如何将 `kubeadm` 创建的 Kubernetes 集群从 1.16.x 版本升级到 1.17.x 版本,以及从版本 1.17.x 升级到 1.17.y ,其中 `y > x`。
|
||||
本页介绍如何将 `kubeadm` 创建的 Kubernetes 集群从 1.17.x 版本升级到 1.18.x 版本,
|
||||
或者从版本 1.18.x 升级到 1.18.y ,其中 `y > x`。
|
||||
|
||||
<!--
|
||||
To see information about upgrading clusters created using older versions of kubeadm,
|
||||
@@ -47,79 +48,68 @@ The upgrade workflow at high level is the following:
|
||||
-->
|
||||
升级工作的基本流程如下:
|
||||
|
||||
1. 升级主控制平面节点。
|
||||
1. 升级其他控制平面节点。
|
||||
1. 升级工作节点。
|
||||
1. 升级主控制平面节点
|
||||
1. 升级其他控制平面节点
|
||||
1. 升级工作节点
|
||||
|
||||
## {{% heading "prerequisites" %}}
|
||||
|
||||
<!--
|
||||
- You need to have a kubeadm Kubernetes cluster running version 1.16.0 or later.
|
||||
- You need to have a kubeadm Kubernetes cluster running version 1.17.0 or later.
|
||||
- [Swap must be disabled](https://serverfault.com/questions/684771/best-way-to-disable-swap-in-linux).
|
||||
- The cluster should use a static control plane and etcd pods or external etcd.
|
||||
- Make sure you read the [release notes]({{< latest-release-notes >}}) carefully.
|
||||
- Make sure to back up any important components, such as app-level state stored in a database.
|
||||
`kubeadm upgrade` does not touch your workloads, only components internal to Kubernetes, but backups are always a best practice.
|
||||
-->
|
||||
- 您需要有一个由 `kubeadm` 创建并运行着 1.16.0 或更高版本的 Kubernetes 集群。
|
||||
- [禁用 Swap](https://serverfault.com/questions/684771/best-way-to-disable-swap-in-linux)。
|
||||
- 集群应使用静态的控制平面和 etcd pod 或者 外部 etcd。
|
||||
- 你需要有一个由 `kubeadm` 创建并运行着 1.17.0 或更高版本的 Kubernetes 集群。
|
||||
- [禁用交换分区](https://serverfault.com/questions/684771/best-way-to-disable-swap-in-linux)。
|
||||
- 集群应使用静态的控制平面和 etcd Pod 或者 外部 etcd。
|
||||
- 务必仔细认真阅读[发行说明]({{< latest-release-notes >}})。
|
||||
- 务必备份所有重要组件,例如存储在数据库中应用层面的状态。
|
||||
`kubeadm upgrade` 不会影响您的工作负载,只会涉及 Kubernetes 内部的组件,但备份终究是好的。
|
||||
`kubeadm upgrade` 不会影响你的工作负载,只会涉及 Kubernetes 内部的组件,但备份终究是好的。
|
||||
|
||||
<!--
|
||||
### Additional information
|
||||
-->
|
||||
### 附加信息
|
||||
|
||||
<!--
|
||||
- All containers are restarted after upgrade, because the container spec hash value is changed.
|
||||
- You only can upgrade from one MINOR version to the next MINOR version,
|
||||
or between PATCH versions of the same MINOR. That is, you cannot skip MINOR versions when you upgrade.
|
||||
For example, you can upgrade from 1.y to 1.y+1, but not from 1.y to 1.y+2.
|
||||
-->
|
||||
- 升级后,因为容器 spec 哈希值已更改,所以所有容器都会重新启动。
|
||||
- 您只能从一个次版本升级到下一个次版本,或者同样次版本的补丁版。也就是说,升级时无法跳过版本。
|
||||
例如,您只能从 1.y 升级到 1.y+1,而不能从 from 1.y 升级到 1.y+2。
|
||||
### 附加信息
|
||||
|
||||
- 升级后,因为容器规约的哈希值已更改,所有容器都会被重新启动。
|
||||
- 你只能从一个次版本升级到下一个次版本,或者在次版本相同时升级补丁版本。
|
||||
也就是说,升级时不可以跳过次版本。
|
||||
例如,你只能从 1.y 升级到 1.y+1,而不能从 from 1.y 升级到 1.y+2。
|
||||
|
||||
<!-- steps -->
|
||||
|
||||
<!--
|
||||
## Determine which version to upgrade to
|
||||
|
||||
Find the latest stable 1.18 version:
|
||||
-->
|
||||
## 确定要升级到哪个版本
|
||||
|
||||
<!--
|
||||
Find the latest stable 1.18 version:
|
||||
|
||||
{{< tabs name="k8s_install_versions" >}}
|
||||
{{% tab name="Ubuntu, Debian or HypriotOS" %}}
|
||||
apt update
|
||||
apt-cache policy kubeadm
|
||||
# find the latest 1.18 version in the list
|
||||
# it should look like 1.18.x-00, where x is the latest patch
|
||||
{{% /tab %}}
|
||||
{{% tab name="CentOS, RHEL or Fedora" %}}
|
||||
yum list --showduplicates kubeadm --disableexcludes=kubernetes
|
||||
# find the latest 1.18 version in the list
|
||||
# it should look like 1.18.x-0, where x is the latest patch
|
||||
{{% /tab %}}
|
||||
{{< /tabs >}}
|
||||
-->
|
||||
找到最新的稳定版 1.18:
|
||||
|
||||
{{< tabs name="k8s_install_versions" >}}
|
||||
{{% tab name="Ubuntu, Debian or HypriotOS" %}}
|
||||
apt update
|
||||
apt-cache policy kubeadm
|
||||
# 在列表中查找最新的 1.18 版本
|
||||
# 它看起来应该是 1.18.x-00 ,其中 x 是最新的补丁
|
||||
{{% tab name="Ubuntu、Debian 或 HypriotOS" %}}
|
||||
```
|
||||
apt update
|
||||
apt-cache policy kubeadm
|
||||
# 在列表中查找最新的 1.18 版本
|
||||
# 它看起来应该是 1.18.x-00 ,其中 x 是最新的补丁
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{% tab name="CentOS, RHEL or Fedora" %}}
|
||||
yum list --showduplicates kubeadm --disableexcludes=kubernetes
|
||||
# 在列表中查找最新的 1.18 版本
|
||||
# 它看起来应该是 1.18.x-0 ,其中 x 是最新的补丁版本
|
||||
{{% tab name="CentOS、RHEL 或 Fedora" %}}
|
||||
```
|
||||
yum list --showduplicates kubeadm --disableexcludes=kubernetes
|
||||
# 在列表中查找最新的 1.18 版本
|
||||
# 它看起来应该是 1.18.x-0 ,其中 x 是最新的补丁版本
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{< /tabs >}}
|
||||
|
||||
@@ -134,32 +124,23 @@ Find the latest stable 1.18 version:
|
||||
|
||||
<!--
|
||||
- On your first control plane node, upgrade kubeadm:
|
||||
|
||||
{{< tabs name="k8s_install_kubeadm_first_cp" >}}
|
||||
{{% tab name="Ubuntu, Debian or HypriotOS" %}}
|
||||
# replace x in 1.18.x-00 with the latest patch version
|
||||
apt-mark unhold kubeadm && \
|
||||
apt-get update && apt-get install -y kubeadm=1.18.x-00 && \
|
||||
apt-mark hold kubeadm
|
||||
{{% /tab %}}
|
||||
{{% tab name="CentOS, RHEL or Fedora" %}}
|
||||
# replace x in 1.18.x-0 with the latest patch version
|
||||
yum install -y kubeadm-1.18.x-0 -disableexcludes=kubernetes
|
||||
{{% /tab %}}
|
||||
{{< /tabs >}}
|
||||
-->
|
||||
- 在第一个控制平面节点上,升级 kubeadm :
|
||||
|
||||
{{< tabs name="k8s_install_kubeadm_first_cp" >}}
|
||||
{{% tab name="Ubuntu, Debian or HypriotOS" %}}
|
||||
# 用最新的修补程序版本替换 1.18.x-00 中的 x
|
||||
apt-mark unhold kubeadm && \
|
||||
apt-get update && apt-get install -y kubeadm=1.18.x-00 && \
|
||||
apt-mark hold kubeadm
|
||||
{{% tab name="Ubuntu、Debian 或 HypriotOS" %}}
|
||||
```shell
|
||||
# 用最新的修补程序版本替换 1.18.x-00 中的 x
|
||||
apt-mark unhold kubeadm && \
|
||||
apt-get update && apt-get install -y kubeadm=1.18.x-00 && \
|
||||
apt-mark hold kubeadm
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{% tab name="CentOS, RHEL or Fedora" %}}
|
||||
# 用最新的修补程序版本替换 1.18.x-0 中的 x
|
||||
yum install -y kubeadm-1.18.x-0 --disableexcludes=kubernetes
|
||||
{{% tab name="CentOS、RHEL 或 Fedora" %}}
|
||||
```shell
|
||||
# 用最新的修补程序版本替换 1.18.x-0 中的 x
|
||||
yum install -y kubeadm-1.18.x-0 --disableexcludes=kubernetes
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{< /tabs >}}
|
||||
|
||||
@@ -202,7 +183,7 @@ Find the latest stable 1.18 version:
|
||||
<!--
|
||||
You should see output similar to this:
|
||||
-->
|
||||
您应该可以看到与下面类似的输出:
|
||||
你应该可以看到与下面类似的输出:
|
||||
|
||||
```none
|
||||
[upgrade/config] Making sure the configuration is correct:
|
||||
@@ -240,18 +221,17 @@ Find the latest stable 1.18 version:
|
||||
<!--
|
||||
This command checks that your cluster can be upgraded, and fetches the versions you can upgrade to.
|
||||
-->
|
||||
此命令检查您的集群是否可以升级,并可以获取到升级的版本。
|
||||
此命令检查你的集群是否可以升级,并可以获取到升级的版本。
|
||||
|
||||
<!--
|
||||
`kubeadm upgrade` also automatically renews the certificates that it manages on this node.
|
||||
To opt-out of certificate renewal the flag `-certificate-renewal=false` can be used.
|
||||
For more information see the [certificate management guide](/docs/tasks/administer-cluster/kubeadm/kubeadm-certs).
|
||||
-->
|
||||
|
||||
{{< note >}}
|
||||
`kubeadm upgrade` 也会自动对它在此节点上管理的证书进行续约。
|
||||
如果选择不对证书进行续约,可以使用标志 `--certificate-renewal=false`。
|
||||
关于更多细节信息,可参见[证书管理指南](/docs/tasks/administer-cluster/kubeadm/kubeadm-certs)。
|
||||
关于更多细节信息,可参见[证书管理指南](/zh/docs/tasks/administer-cluster/kubeadm/kubeadm-certs)。
|
||||
{{</ note >}}
|
||||
|
||||
<!--
|
||||
@@ -272,7 +252,7 @@ For more information see the [certificate management guide](/docs/tasks/administ
|
||||
<!--
|
||||
You should see output similar to this:
|
||||
-->
|
||||
您应该可以看见与下面类似的输出:
|
||||
你应该可以看见与下面类似的输出:
|
||||
|
||||
```none
|
||||
[upgrade/config] Making sure the configuration is correct:
|
||||
@@ -364,8 +344,9 @@ For more information see the [certificate management guide](/docs/tasks/administ
|
||||
-->
|
||||
- 手动升级你的 CNI 驱动插件。
|
||||
|
||||
您的容器网络接口(CNI)驱动应该提供了程序自身的升级说明。
|
||||
检查[插件](/docs/concepts/cluster-administration/addons/)页面查找您 CNI 所提供的程序,并查看是否需要其他升级步骤。
|
||||
你的容器网络接口(CNI)驱动应该提供了程序自身的升级说明。
|
||||
参阅[插件](/zh/docs/concepts/cluster-administration/addons/)页面查找你 CNI 所提供的程序,
|
||||
并查看是否需要其他升级步骤。
|
||||
|
||||
如果 CNI 提供程序作为 DaemonSet 运行,则在其他控制平面节点上不需要此步骤。
|
||||
|
||||
@@ -414,18 +395,27 @@ sudo kubeadm upgrade apply
|
||||
|
||||
{{< tabs name="k8s_install_kubelet" >}}
|
||||
{{% tab name="Ubuntu、Debian 或 HypriotOS" %}}
|
||||
# 用最新的补丁版本替换 1.18.x-00 中的 x
|
||||
apt-mark unhold kubelet kubectl && \
|
||||
apt-get update && apt-get install -y kubelet=1.18.x-00 kubectl=1.18.x-00 && \
|
||||
apt-mark hold kubelet kubectl
|
||||
-
|
||||
# 从 apt-get 的 1.1 版本开始,你也可以使用下面的方法:
|
||||
apt-get update && \
|
||||
apt-get install -y --allow-change-held-packages kubelet=1.18.x-00 kubectl=1.18.x-00
|
||||
```shell
|
||||
# 用最新的补丁版本替换 1.18.x-00 中的 x
|
||||
apt-mark unhold kubelet kubectl && \
|
||||
apt-get update && apt-get install -y kubelet=1.18.x-00 kubectl=1.18.x-00 && \
|
||||
apt-mark hold kubelet kubectl
|
||||
```
|
||||
|
||||
从 apt-get 的 1.1 版本开始,你也可以使用下面的方法:
|
||||
|
||||
```shell
|
||||
apt-get update && \
|
||||
apt-get install -y --allow-change-held-packages kubelet=1.18.x-00 kubectl=1.18.x-00
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{% tab name="CentOS、RHEL 或 Fedora" %}}
|
||||
# 用最新的补丁版本替换 1.18.x-00 中的 x
|
||||
yum install -y kubelet-1.18.x-0 kubectl-1.18.x-0 --disableexcludes=kubernetes
|
||||
|
||||
用最新的补丁版本替换 1.18.x-00 中的 x
|
||||
|
||||
```shell
|
||||
yum install -y kubelet-1.18.x-0 kubectl-1.18.x-0 --disableexcludes=kubernetes
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{< /tabs >}}
|
||||
|
||||
@@ -456,36 +446,33 @@ without compromising the minimum required capacity for running your workloads.
|
||||
|
||||
<!--
|
||||
- Upgrade kubeadm on all worker nodes:
|
||||
|
||||
{{< tabs name="k8s_install_kubeadm_worker_nodes" >}}
|
||||
{{% tab name="Ubuntu, Debian or HypriotOS" %}}
|
||||
# replace x in 1.18.x-00 with the latest patch version
|
||||
apt-mark unhold kubeadm && \
|
||||
apt-get update && apt-get install -y kubeadm=1.18.x-00 && \
|
||||
apt-mark hold kubeadm
|
||||
{{% /tab %}}
|
||||
{{% tab name="CentOS, RHEL or Fedora" %}}
|
||||
# replace x in 1.18.x-0 with the latest patch version
|
||||
yum install -y kubeadm-1.18.x-0 -disableexcludes=kubernetes
|
||||
{{% /tab %}}
|
||||
{{< /tabs >}}
|
||||
-->
|
||||
- 在所有工作节点升级 kubeadm:
|
||||
|
||||
{{< tabs name="k8s_install_kubeadm_worker_nodes" >}}
|
||||
{{% tab name="Ubuntu、Debian 或 HypriotOS" %}}
|
||||
# 将 1.18.x-00 中的 x 替换为最新的补丁版本
|
||||
apt-mark unhold kubeadm && \
|
||||
apt-get update && apt-get install -y kubeadm=1.18.x-00 && \
|
||||
apt-mark hold kubeadm
|
||||
-
|
||||
# 从 apt-get 的 1.1 版本开始,你也可以使用下面的方法:
|
||||
apt-get update && \
|
||||
apt-get install -y --allow-change-held-packages kubeadm=1.18.x-00
|
||||
|
||||
```shell
|
||||
# 将 1.18.x-00 中的 x 替换为最新的补丁版本
|
||||
apt-mark unhold kubeadm && \
|
||||
apt-get update && apt-get install -y kubeadm=1.18.x-00 && \
|
||||
apt-mark hold kubeadm
|
||||
```
|
||||
|
||||
从 apt-get 的 1.1 版本开始,你也可以使用下面的方法:
|
||||
|
||||
```shell
|
||||
apt-get update && \
|
||||
apt-get install -y --allow-change-held-packages kubeadm=1.18.x-00
|
||||
```
|
||||
|
||||
{{% /tab %}}
|
||||
{{% tab name="CentOS、RHEL 或 Fedora" %}}
|
||||
# 用最新的补丁版本替换 1.18.x-00 中的 x
|
||||
yum install -y kubeadm-1.18.x-0 --disableexcludes=kubernetes
|
||||
|
||||
```shell
|
||||
# 用最新的补丁版本替换 1.18.x-00 中的 x
|
||||
yum install -y kubeadm-1.18.x-0 --disableexcludes=kubernetes
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{< /tabs >}}
|
||||
|
||||
@@ -557,18 +544,29 @@ without compromising the minimum required capacity for running your workloads.
|
||||
|
||||
{{< tabs name="k8s_kubelet_and_kubectl" >}}
|
||||
{{% tab name="Ubuntu、Debian 或 HypriotOS" %}}
|
||||
# 将 1.18.x-00 中的 x 替换为最新的补丁版本
|
||||
apt-mark unhold kubelet kubectl && \
|
||||
apt-get update && apt-get install -y kubelet=1.18.x-00 kubectl=1.18.x-00 && \
|
||||
apt-mark hold kubelet kubectl
|
||||
-
|
||||
# 从 apt-get 的 1.1 版本开始,你也可以使用下面的方法:
|
||||
apt-get update && \
|
||||
apt-get install -y --allow-change-held-packages kubelet=1.18.x-00 kubectl=1.18.x-00
|
||||
|
||||
```shell
|
||||
# 将 1.18.x-00 中的 x 替换为最新的补丁版本
|
||||
apt-mark unhold kubelet kubectl && \
|
||||
apt-get update && apt-get install -y kubelet=1.18.x-00 kubectl=1.18.x-00 && \
|
||||
apt-mark hold kubelet kubectl
|
||||
```
|
||||
|
||||
从 apt-get 的 1.1 版本开始,你也可以使用下面的方法:
|
||||
|
||||
```
|
||||
apt-get update && \
|
||||
apt-get install -y --allow-change-held-packages kubelet=1.18.x-00 kubectl=1.18.x-00
|
||||
```
|
||||
|
||||
{{% /tab %}}
|
||||
{{% tab name="CentOS, RHEL or Fedora" %}}
|
||||
# 将 1.18.x-00 中的 x 替换为最新的补丁版本
|
||||
yum install -y kubelet-1.18.x-0 kubectl-1.18.x-0 --disableexcludes=kubernetes
|
||||
|
||||
```shell
|
||||
# 将 1.18.x-00 中的 x 替换为最新的补丁版本
|
||||
yum install -y kubelet-1.18.x-0 kubectl-1.18.x-0 --disableexcludes=kubernetes
|
||||
```
|
||||
|
||||
{{% /tab %}}
|
||||
{{< /tabs >}}
|
||||
|
||||
@@ -601,10 +599,10 @@ without compromising the minimum required capacity for running your workloads.
|
||||
-->
|
||||
- 通过将节点标记为可调度,让节点重新上线:
|
||||
|
||||
```shell
|
||||
# 将 <node-to-drain> 替换为当前节点的名称
|
||||
kubectl uncordon <node-to-drain>
|
||||
```
|
||||
```shell
|
||||
# 将 <node-to-drain> 替换为当前节点的名称
|
||||
kubectl uncordon <node-to-drain>
|
||||
```
|
||||
|
||||
<!--
|
||||
## Verify the status of the cluster
|
||||
@@ -638,9 +636,9 @@ To recover from a bad state, you can also run `kubeadm upgrade --force` without
|
||||
-->
|
||||
## 从故障状态恢复
|
||||
|
||||
如果 `kubeadm upgrade` 失败并且没有回滚,例如由于执行期间意外关闭,您可以再次运行 `kubeadm upgrade`。
|
||||
此命令是幂等的,并最终确保实际状态是您声明的所需状态。
|
||||
要从故障状态恢复,您还可以运行 `kubeadm upgrade --force` 而不去更改集群正在运行的版本。
|
||||
如果 `kubeadm upgrade` 失败并且没有回滚,例如由于执行期间意外关闭,你可以再次运行 `kubeadm upgrade`。
|
||||
此命令是幂等的,并最终确保实际状态是你声明的所需状态。
|
||||
要从故障状态恢复,你还可以运行 `kubeadm upgrade --force` 而不去更改集群正在运行的版本。
|
||||
|
||||
<!--
|
||||
During upgrade kubeadm writes the following backup folders under `/etc/kubernetes/tmp`:
|
||||
@@ -690,7 +688,7 @@ and post-upgrade manifest file for a certain component, a backup file for it wil
|
||||
|
||||
`kubeadm upgrade apply` 做了以下工作:
|
||||
|
||||
- 检查您的集群是否处于可升级状态:
|
||||
- 检查你的集群是否处于可升级状态:
|
||||
- API 服务器是可访问的
|
||||
- 所有节点处于 `Ready` 状态
|
||||
- 控制面是健康的
|
||||
|
||||
Reference in New Issue
Block a user