This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.11.5.2. 为直接卷迁移启用持久性卷大小
您可以启用持久性卷(PV)调整直接卷迁移的大小,以避免在目标集群中耗尽磁盘空间。
当 PV 的磁盘用量达到配置级别时,MigrationController
自定义资源(CR)会将持久性卷声明(PVC)的请求存储容量与其实际置备的容量进行比较。然后,它会计算目标集群所需的空间。
pv_resizing_threshold
参数决定何时使用 PV 调整大小。默认阈值是 3%
。这意味着,当 PV 的磁盘用量超过 97%
时,PV 会调整大小。您可以提高这个阈值,以便 PV 调整大小在较低的磁盘用量级别上发生。
PVC 容量根据以下标准计算:
-
如果 PVC 请求的存储容量(
spec.resources.requests.storage
)不等于实际置备的容量(status.capacity.storage
),则会使用较大的值。 - 如果 PV 通过 PVC 置备,然后更改以便其 PV 和 PVC 容量不再匹配,则会使用较大的值。
先决条件
-
PVC 必须附加到一个或多个正在运行的 pod,以便
MigrationController
CR 可以执行命令。
流程
- 登录主机集群。
通过修补
MigrationController
CR 来启用 PV 调整大小:oc patch migrationcontroller migration-controller -p '{"spec":{"enable_dvm_pv_resizing":true}}' \ --type='merge' -n openshift-migration
$ oc patch migrationcontroller migration-controller -p '{"spec":{"enable_dvm_pv_resizing":true}}' \
1 --type='merge' -n openshift-migration
Copy to Clipboard Copied! - 1
- 将值设为
false
可禁用 PV 大小调整。
可选:更新
pv_resizing_threshold
参数以增加阈值:oc patch migrationcontroller migration-controller -p '{"spec":{"pv_resizing_threshold":41}}' \ --type='merge' -n openshift-migration
$ oc patch migrationcontroller migration-controller -p '{"spec":{"pv_resizing_threshold":41}}' \
1 --type='merge' -n openshift-migration
Copy to Clipboard Copied! - 1
- 默认值为
3
。
超过阈值时,
MigPlan
CR 状态中会显示以下状态信息:status: conditions: ... - category: Warn durable: true lastTransitionTime: "2021-06-17T08:57:01Z" message: 'Capacity of the following volumes will be automatically adjusted to avoid disk capacity issues in the target cluster: [pvc-b800eb7b-cf3b-11eb-a3f7-0eae3e0555f3]' reason: Done status: "False" type: PvCapacityAdjustmentRequired
status: conditions: ... - category: Warn durable: true lastTransitionTime: "2021-06-17T08:57:01Z" message: 'Capacity of the following volumes will be automatically adjusted to avoid disk capacity issues in the target cluster: [pvc-b800eb7b-cf3b-11eb-a3f7-0eae3e0555f3]' reason: Done status: "False" type: PvCapacityAdjustmentRequired
Copy to Clipboard Copied! 注意对于 AWS gp2 存储,因为 gp2 计算卷用量和大小的方式,这个信息不会出现,除非
pv_resizing_threshold
为 42% 或更高。(BZ#1973148)