9.4. 删除保留的 Postgres 13 PVC
在将 Red Hat Ansible Automation Platform 从使用 Postgres 13 的版本升级到使用 Postgres 15 的版本后,原始 Postgres 13 持久性卷声明(PVC)不会自动删除使用受管数据库的自动化控制器部署。如果您的部署使用外部数据库,则不需要 PVC 清理。在确认升级成功完成后,您必须手动删除保留的 PVC。
先决条件
- 您已将 Ansible Automation Platform 升级到使用 Postgres 15 的版本。
- 您的自动化控制器部署使用受管数据库。使用外部数据库的部署不需要 PVC 清理。
流程
确认 Postgres 15 pod 正在运行:
$ oc get pods -n <your_namespace> | grep postgres验证名称中包含
postgres-15的 pod 是否处于Running状态。列出命名空间中的 PVC 以识别保留的 Postgres 13 PVC:
$ oc get pvc -n <your_namespace>保留 Postgres 13 PVC 遵循以下命名格式:
postgres-13-<deployment_name>-postgres-13-0当前的 Postgres 15 PVC 采用以下命名格式:
postgres-15-<deployment_name>-postgres-15-0删除保留的 Postgres 13 PVC:
$ oc delete pvc postgres-13-<deployment_name>-postgres-13-0 -n <your_namespace>
在确认升级成功完成前,不要删除 Postgres 13 PVC。如果升级失败,则保留卷可用于数据恢复。
AutomationController 自定义资源定义(CRD)中的 postgres_keep_pvc_after_upgrade 字段在 Ansible Automation Platform 2.4 及更高版本中没有影响。总是需要手动 PVC 清理。