简体中文版经机器翻译而成,仅供参考。如与英语版出现任何冲突,应以英语版为准。
Red Hat OpenShift 虚拟化灾难恢复的源集群设置
本节提供有关使用 NetApp Trident Protect 和 AppMirror 设置源集群以对 OpenShift Virtualization 工作负载进行灾难恢复的信息。这包括使用 ONTAP S3 创建 AppVault,为源虚拟机创建 Trident Protect 应用程序,以及使用 Trident Protect 创建该虚拟机的按需和计划快照。这些步骤对于确保正确配置源集群以将数据复制到灾难恢复目标集群并在发生灾难时恢复虚拟机至关重要。
设置 OpenShift Virtualization 的灾难恢复源集群
以下所有步骤均在源集群上执行,该集群是受保护虚拟机当前正在运行的集群。
使用 ONTAP S3 创建 AppVault
本节展示如何使用 ONTAP S3 对象存储在 Trident Protect 中设置 AppVault 对象。在此步骤中创建的 AppVault 将用于存储来自源集群的复制数据,该数据将用于在灾难恢复目标集群中进行恢复。
使用 oc 命令和下面显示的 yaml 文件为 ONTAP s3 创建密钥和 AppVault 自定义资源。请确保在 trident-protect 命名空间中创建它们。
显示示例
apiVersion: v1
# You can provide the keys either as stringData or base 64 encoded data
stringData:
accessKeyID: "<access key id as obtained from ONTAP>"
secretAccessKey: "<secret access key as obtained from ONTAP>"
#data:
#accessKeyID: <base 64 encoded value of access key>
#secretAccessKey: <base 64 encoded value of secret access key>
kind: Secret
metadata:
name: appvault-secret
namespace: trident-protect
type: Opaque
apiVersion: protect.trident.netapp.io/v1
kind: AppVault
metadata:
name: ontap-s3-appvault
namespace: trident-protect
spec:
providerConfig:
s3:
bucketName: oc-dr
endpoint: <data lif to use to access S3>
secure: "false" # Setting this to "false" will disable TLS, which is not recommended for production environments.
skipCertValidation: "true" # When TLS is enabled, setting skipCertValidation to "true" will skip TLS certificate validation, which is not recommended for production environments.
providerCredentials:
accessKeyID:
valueFromSecret:
key: accessKeyID
name: appvault-secret
secretAccessKey:
valueFromSecret:
key: secretAccessKey
name: appvault-secret
providerType: OntapS3
确保 ONTAP S3 保管库已创建且处于"可用"状态
oc create -f app-vault-secret.yaml -n trident-protect
oc create -f app-vault.yaml -n trident-protect

为源虚拟机创建 Trident Protect 应用程序
在源 VM 所在的命名空间中创建应用程序自定义资源。
显示示例
# cat app.yaml
apiVersion: protect.trident.netapp.io/v1
kind: Application
metadata:
creationTimestamp: null
name: test-source-app
namespace: test-dr-ns
spec:
includedNamespaces:
- namespace: test-dr-ns
tridentctl-protect create app <source-vm> -n <source-ns> --namespaces <source-ns>

App自定义资源中包含的命名空间中的VM及其PVC如下所示。

使用 Trident Protect 创建虚拟机快照
您可以使用 Trident Protect CLI 或 API 创建虚拟机的按需快照。此快照将存储在上一步中创建的 AppVault 中,可用于灾难恢复目标集群中的恢复。
显示示例
# snapshot.yaml
apiVersion: protect.trident.netapp.io/v1
kind: Snapshot
metadata:
name: test-source-dr-init-snapshot
namespace: test-dr-ns
spec:
applicationRef: test-source-app
appVaultRef: ontap-s3-appvault
reclaimPolicy: Delete

使用 Trident Protect 创建虚拟机的计划快照
您也可以通过在与 Application 自定义资源相同的命名空间中创建 Schedule 自定义资源来创建计划快照。该计划将按照指定的计划自动创建虚拟机的快照,并将其存储在 AppVault 中。
显示示例
apiVersion: protect.trident.netapp.io/v1
kind: Schedule
metadata:
name: appmirror-sched1
spec:
appVaultRef: ontap-s3-appvault
applicationRef: test-source-app
backupRetention: "0"
enabled: true
granularity: Custom
recurrenceRule: |-
DTSTART:20240901T000200Z
RRULE:FREQ=MINUTELY;INTERVAL=5
snapshotRetention: "2"