Skip to content

Commit a6d7f1c

Browse files
authored
Merge pull request #33647 from fenggw-fnst/tasks-10
[zh] Sync for tasks-10: change-pv-reclaim-policy.md and controller-manager-leader-migration.md
2 parents 938c9ac + 8c3b499 commit a6d7f1c

File tree

2 files changed

+107
-46
lines changed

2 files changed

+107
-46
lines changed

content/zh/docs/tasks/administer-cluster/change-pv-reclaim-policy.md

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,16 @@ PersistentVolumes 可以有多种回收策略,包括 "Retain"、"Recycle" 和
5454
kubectl get pv
5555
```
5656

57+
<!--
58+
The output is similar to this:
59+
-->
5760
输出类似于这样:
5861

59-
```
60-
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM REASON AGE
61-
pvc-b6efd8da-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim1 10s
62-
pvc-b95650f8-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim2 6s
63-
pvc-bb3ca71d-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim3 3s
62+
```none
63+
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
64+
pvc-b6efd8da-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim1 manual 10s
65+
pvc-b95650f8-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim2 manual 6s
66+
pvc-bb3ca71d-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim3 manual 3s
6467
```
6568

6669
<!--
@@ -112,11 +115,11 @@ PersistentVolumes 可以有多种回收策略,包括 "Retain"、"Recycle" 和
112115
-->
113116
输出类似于这样:
114117

115-
```
116-
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM REASON AGE
117-
pvc-b6efd8da-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim1 40s
118-
pvc-b95650f8-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim2 36s
119-
pvc-bb3ca71d-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Retain Bound default/claim3 33s
118+
```none
119+
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
120+
pvc-b6efd8da-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim1 manual 40s
121+
pvc-b95650f8-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim2 manual 36s
122+
pvc-bb3ca71d-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Retain Bound default/claim3 manual 33s
120123
```
121124

122125
<!--
@@ -136,9 +139,17 @@ PersistentVolumes 可以有多种回收策略,包括 "Retain"、"Recycle" 和
136139
* 进一步了解 [PersistentVolumes](/zh/docs/concepts/storage/persistent-volumes/)
137140
* 进一步了解 [PersistentVolumeClaims](/zh/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims)
138141

139-
### 参考
142+
### 参考 {#reference}
140143

141-
* [PersistentVolume](/docs/api-reference/{{< param "version" >}}/#persistentvolume-v1-core)
142-
* [PersistentVolumeClaim](/docs/api-reference/{{< param "version" >}}/#persistentvolumeclaim-v1-core)
143-
* 参阅 [PersistentVolumeSpec](/docs/api-reference/{{< param "version" >}}/#persistentvolumeclaim-v1-core) 的 `persistentVolumeReclaimPolicy` 字段
144+
<!--
145+
* {{< api-reference page="config-and-storage-resources/persistent-volume-v1" >}}
146+
* Pay attention to the `.spec.persistentVolumeReclaimPolicy`
147+
[field](/docs/reference/kubernetes-api/config-and-storage-resources/persistent-volume-v1/#PersistentVolumeSpec)
148+
of PersistentVolume.
149+
* {{< api-reference page="config-and-storage-resources/persistent-volume-claim-v1" >}}
150+
-->
151+
* {{< api-reference page="config-and-storage-resources/persistent-volume-v1" >}}
152+
* 注意 PersistentVolume 的 `.spec.persistentVolumeReclaimPolicy`
153+
[字段](/docs/reference/kubernetes-api/config-and-storage-resources/persistent-volume-v1/#PersistentVolumeSpec)
154+
* {{< api-reference page="config-and-storage-resources/persistent-volume-claim-v1" >}}
144155

content/zh/docs/tasks/administer-cluster/controller-manager-leader-migration.md

Lines changed: 82 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ content_type: task
1515

1616
<!-- overview -->
1717

18-
{{< feature-state state="beta" for_k8s_version="v1.22" >}}
18+
{{< feature-state for_k8s_version="v1.24" state="stable" >}}
1919

2020
{{< glossary_definition term_id="cloud-controller-manager" length="all">}}
2121

@@ -48,41 +48,41 @@ Leader Migration can be enabled by setting `--enable-leader-migration` on `kube-
4848
Leader Migration only applies during the upgrade and can be safely disabled or left enabled after the upgrade is complete.
4949
5050
This guide walks you through the manual process of upgrading the control plane from `kube-controller-manager` with
51-
built-in cloud provider to running both `kube-controller-manager` and `cloud-controller-manager`.
52-
If you use a tool to administrator the cluster, please refer to the documentation of the tool and the cloud provider for more details.
51+
built-in cloud provider to running both `kube-controller-manager` and `cloud-controller-manager`.
52+
If you use a tool to deploy and manage the cluster, please refer to the documentation of the tool and the cloud provider for specific instructions of the migration.
5353
-->
5454
领导者迁移可以通过在 `kube-controller-manager``cloud-controller-manager` 上设置
5555
`--enable-leader-migration` 来启用。
5656
领导者迁移仅在升级期间适用,并且在升级完成后可以安全地禁用或保持启用状态。
5757

5858
本指南将引导你手动将控制平面从内置的云驱动的 `kube-controller-manager` 升级为
5959
同时运行 `kube-controller-manager``cloud-controller-manager`
60-
如果使用某种工具来管理群集,请参阅对应工具和云驱动的文档以获取更多详细信息
60+
如果使用某种工具来部署和管理集群,请参阅对应工具和云驱动的文档以获取迁移的具体说明
6161

6262
## {{% heading "prerequisites" %}}
6363

6464
<!--
65-
It is assumed that the control plane is running Kubernetes version N and to be upgraded to version N + 1.
66-
Although it is possible to migrate within the same version, ideally the migration should be performed as part of a upgrade so that changes of configuration can be aligned to each release.
67-
The exact versions of N and N + 1 depend on each cloud provider. For example, if a cloud provider builds a `cloud-controller-manager` to work with Kubernetes 1.22, then N can be 1.21 and N + 1 can be 1.22.
65+
It is assumed that the control plane is running Kubernetes version N and to be upgraded to version N + 1.
66+
Although it is possible to migrate within the same version, ideally the migration should be performed as part of an upgrade so that changes of configuration can be aligned to each release.
67+
The exact versions of N and N + 1 depend on each cloud provider. For example, if a cloud provider builds a `cloud-controller-manager` to work with Kubernetes 1.24, then N can be 1.23 and N + 1 can be 1.24.
6868
69-
The control plane nodes should run `kube-controller-manager` with Leader Election enabled through `--leader-elect=true`.
70-
As of version N, an in-tree cloud privider must be set with `--cloud-provider` flag and `cloud-controller-manager` should not yet be deployed.
69+
The control plane nodes should run `kube-controller-manager` with Leader Election enabled, which is the default.
70+
As of version N, an in-tree cloud provider must be set with `--cloud-provider` flag and `cloud-controller-manager` should not yet be deployed.
7171
-->
7272
假定控制平面正在运行 Kubernetes 版本 N,要升级到版本 N+1。
7373
尽管可以在同一版本内进行迁移,但理想情况下,迁移应作为升级的一部分执行,
7474
以便可以配置的变更可以与发布版本变化对应起来。
75-
N 和 N+1 的确切版本值取决于各个云厂商。例如,如果云厂商构建了一个可与 Kubernetes 1.22
76-
配合使用的 `cloud-controller-manager`,则 N 可以为 1.21,N+1 可以为 1.22
75+
N 和 N+1 的确切版本值取决于各个云厂商。例如,如果云厂商构建了一个可与 Kubernetes 1.24
76+
配合使用的 `cloud-controller-manager`,则 N 可以为 1.23,N+1 可以为 1.24
7777

78-
控制平面节点应运行 `kube-controller-manager`,并通过 `--leader-elect=true` 启用领导者选举
78+
控制平面节点应运行 `kube-controller-manager` 并启用领导者选举,这也是默认设置
7979
在版本 N 中,树内云驱动必须设置 `--cloud-provider` 标志,而且 `cloud-controller-manager`
8080
应该尚未部署。
8181

8282
<!--
83-
The out-of-tree cloud provider must have built a `cloud-controller-manager` with Leader Migration implementation.
83+
The out-of-tree cloud provider must have built a `cloud-controller-manager` with Leader Migration implementation.
8484
If the cloud provider imports `k8s.io/cloud-provider` and `k8s.io/controller-manager` of version v0.21.0 or later, Leader Migration will be available.
85-
However, for version before v0.22.0, Leader Migration is alpha and requires feature gate `ControllerManagerLeaderMigration` to be enabled.
85+
However, for version before v0.22.0, Leader Migration is alpha and requires feature gate `ControllerManagerLeaderMigration` to be enabled in `cloud-controller-manager`.
8686
8787
This guide assumes that kubelet of each control plane node starts `kube-controller-manager`
8888
and `cloud-controller-manager` as static pods defined by their manifests.
@@ -95,8 +95,8 @@ please grant the needed access in a way that matches the mode.
9595
树外云驱动必须已经构建了一个实现了领导者迁移的 `cloud-controller-manager`
9696
如果云驱动导入了 v0.21.0 或更高版本的 `k8s.io/cloud-provider``k8s.io/controller-manager`
9797
则可以进行领导者迁移。
98-
但是,对 v0.22.0 以下的版本,领导者迁移是一项 Alpha 阶段功能,需要启用特性门控
99-
`ControllerManagerLeaderMigration`
98+
但是,对 v0.22.0 以下的版本,领导者迁移是一项 Alpha 阶段功能,需要在 `cloud-controller-manager`
99+
中启用特性门控 `ControllerManagerLeaderMigration`
100100

101101
本指南假定每个控制平面节点的 kubelet 以静态 Pod 的形式启动 `kube-controller-manager`
102102
`cloud-controller-manager`,静态 Pod 的定义在清单文件中。
@@ -156,9 +156,8 @@ Leader Migration can be enabled without a configuration. Please see [Default Con
156156

157157
```yaml
158158
kind: LeaderMigrationConfiguration
159-
apiVersion: controllermanager.config.k8s.io/v1beta1
159+
apiVersion: controllermanager.config.k8s.io/v1
160160
leaderName: cloud-provider-extraction-migration
161-
resourceLock: leases
162161
controllerLeaders:
163162
- name: route
164163
component: kube-controller-manager
@@ -168,6 +167,27 @@ controllerLeaders:
168167
component: kube-controller-manager
169168
```
170169
170+
<!--
171+
Alternatively, because the controllers can run under either controller managers, setting `component` to `*`
172+
for both sides makes the configuration file consistent between both parties of the migration.
173+
-->
174+
或者,由于控制器可以在任一控制器管理器下运行,因此将双方的 `component` 设置为 `*`
175+
可以使迁移双方的配置文件保持一致。
176+
177+
```yaml
178+
# 通配符版本
179+
kind: LeaderMigrationConfiguration
180+
apiVersion: controllermanager.config.k8s.io/v1
181+
leaderName: cloud-provider-extraction-migration
182+
controllerLeaders:
183+
- name: route
184+
component: *
185+
- name: service
186+
component: *
187+
- name: cloud-node-lifecycle
188+
component: *
189+
```
190+
171191
<!--
172192
On each control plane node, save the content to `/etc/leadermigration.conf`,
173193
and update the manifest of `kube-controller-manager` so that the file is mounted inside the container at the same location.
@@ -191,20 +211,21 @@ Restart `kube-controller-manager` on each node. At this moment, `kube-controller
191211
<!--
192212
### Deploy Cloud Controller Manager
193213

194-
In version N + 1, the desired state of controller-to-manager assignment can be represented by a new configuration file, shown as follows.
214+
In version N + 1, the desired state of controller-to-manager assignment can be represented by a new configuration file, shown as follows.
195215
Please note `component` field of each `controllerLeaders` changing from `kube-controller-manager` to `cloud-controller-manager`.
216+
Alternatively, use the wildcard version mentioned above, which has the same effect.
196217
-->
197218
### 部署云控制器管理器
198219

199220
在版本 N+1 中,如何将控制器分配给不同管理器的预期分配状态可以由新的配置文件表示,
200221
如下所示。请注意,各个 `controllerLeaders` 的 `component` 字段从 `kube-controller-manager`
201222
更改为 `cloud-controller-manager`。
223+
或者,使用上面提到的通配符版本,它具有相同的效果。
202224

203225
```yaml
204226
kind: LeaderMigrationConfiguration
205-
apiVersion: controllermanager.config.k8s.io/v1beta1
227+
apiVersion: controllermanager.config.k8s.io/v1
206228
leaderName: cloud-provider-extraction-migration
207-
resourceLock: leases
208229
controllerLeaders:
209230
- name: route
210231
component: cloud-controller-manager
@@ -215,28 +236,28 @@ controllerLeaders:
215236
```
216237

217238
<!--
218-
When creating control plane nodes of version N + 1, the content should be deploy to `/etc/leadermigration.conf`.
219-
The manifest of `cloud-controller-manager` should be updated to mount the configuration file in
220-
the same manner as `kube-controller-manager` of version N. Similarly, add `--feature-gates=ControllerManagerLeaderMigration=true`,
221-
`--enable-leader-migration`, and `--leader-migration-config=/etc/leadermigration.conf` to the arguments of `cloud-controller-manager`.
239+
When creating control plane nodes of version N + 1, the content should be deployed to `/etc/leadermigration.conf`.
240+
The manifest of `cloud-controller-manager` should be updated to mount the configuration file in
241+
the same manner as `kube-controller-manager` of version N. Similarly, add `--enable-leader-migration`
242+
and `--leader-migration-config=/etc/leadermigration.conf` to the arguments of `cloud-controller-manager`.
222243

223-
Create a new control plane node of version N + 1 with the updated `cloud-controller-manager` manifest,
224-
and with the `--cloud-provider` flag unset for `kube-controller-manager`.
225-
`kube-controller-manager` of version N + 1 MUST NOT have Leader Migration enabled because,
226-
with an external cloud provider, it does not run the migrated controllers anymore and thus it is not involved in the migration.
244+
Create a new control plane node of version N + 1 with the updated `cloud-controller-manager` manifest,
245+
and with the `--cloud-provider` flag set to `external` for `kube-controller-manager`.
246+
`kube-controller-manager` of version N + 1 MUST NOT have Leader Migration enabled because,
247+
with an external cloud provider, it does not run the migrated controllers anymore, and thus it is not involved in the migration.
227248

228249
Please refer to [Cloud Controller Manager Administration](/docs/tasks/administer-cluster/running-cloud-controller/)
229250
for more detail on how to deploy `cloud-controller-manager`.
230251
-->
231252
当创建版本 N+1 的控制平面节点时,应将如上内容写入到 `/etc/leadermigration.conf`。
232253
你需要更新 `cloud-controller-manager` 的清单,以与版本 N 的 `kube-controller-manager`
233254
相同的方式挂载配置文件。
234-
类似地,添加 `--feature-gates=ControllerManagerLeaderMigration=true`、`--enable-leader-migration`
255+
类似地,添加 `--enable-leader-migration`
235256
和 `--leader-migration-config=/etc/leadermigration.conf` 到 `cloud-controller-manager`
236257
的参数中。
237258

238259
使用已更新的 `cloud-controller-manager` 清单创建一个新的 N+1 版本的控制平面节点,
239-
同时确保没有设置 `kube-controller-manager` 的 `--cloud-provider` 标志
260+
同时设置 `kube-controller-manager` 的 `--cloud-provider` 标志为 `external`
240261
版本为 N+1 的 `kube-controller-manager` 不能启用领导者迁移,
241262
因为在使用外部云驱动的情况下,它不再运行已迁移的控制器,因此不参与迁移。
242263

@@ -311,9 +332,38 @@ For `kube-controller-manager` and `cloud-controller-manager`, if there are no fl
311332
对于 `kube-controller-manager` 和 `cloud-controller-manager`,如果没有用参数来启用树内云驱动或者改变控制器属主,
312333
则可以使用默认配置来避免手动创建配置文件。
313334

335+
<!--
336+
### Special case: migrating the Node IPAM controller {#node-ipam-controller-migration}
337+
338+
If your cloud provider provides an implementation of Node IPAM controller, you should switch to the implementation in `cloud-controller-manager`.
339+
Disable Node IPAM controller in `kube-controller-manager` of version N + 1 by adding `--controllers=*,-nodeipam` to its flags.
340+
Then add `nodeipam` to the list of migrated controllers.
341+
-->
342+
### 特殊情况:迁移节点 IPAM 控制器 {#node-ipam-controller-migration}
343+
344+
如果你的云供应商提供了节点 IPAM 控制器的实现,你应该切换到 `cloud-controller-manager` 中的实现。
345+
通过在其标志中添加 `--controllers=*,-nodeipam` 来禁用 N+1 版本的 `kube-controller-manager` 中的节点 IPAM 控制器。
346+
然后将 `nodeipam` 添加到迁移的控制器列表中。
347+
348+
```yaml
349+
# 通配符版本,带有 nodeipam
350+
kind: LeaderMigrationConfiguration
351+
apiVersion: controllermanager.config.k8s.io/v1
352+
leaderName: cloud-provider-extraction-migration
353+
controllerLeaders:
354+
- name: route
355+
component: *
356+
- name: service
357+
component: *
358+
- name: cloud-node-lifecycle
359+
component: *
360+
- name: nodeipam
361+
- component: *
362+
```
363+
314364
## {{% heading "whatsnext" %}}
315365
<!--
316-
- Read the [Controller Manager Leader Migration](https://github.com/kubernetes/enhancements/tree/master/keps/sig-cloud-provider/2436-controller-manager-leader-migration) enhancement proposal
366+
- Read the [Controller Manager Leader Migration](https://github.com/kubernetes/enhancements/tree/master/keps/sig-cloud-provider/2436-controller-manager-leader-migration) enhancement proposal.
317367
-->
318368
- 阅读[领导者迁移控制器管理器](https://github.com/kubernetes/enhancements/tree/master/keps/sig-cloud-provider/2436-controller-manager-leader-migration)
319369
改进建议提案。

0 commit comments

Comments
 (0)