Breadcrumb

  1. Red Hat Interactive Learning Portal
  2. OpenShift learning
  3. Red Hat OpenShift Virtualization disaster recovery
  4. Automate backups

Red Hat OpenShift Virtualization disaster recovery

Implement disaster recovery with storage replication and OpenShift APIs for Data Protection (OADP) for Red Hat OpenShift Virtualization environments that use third-party storage. Efficiently and consistently recover your data across disparate clusters. 

In a production environment, backups should be performed automatically and regularly. OpenShift APIs for Data Protection supports this via the Schedule custom resource. The following example creates a schedule to perform a metadata-only backup every hour at 22 minutes past the hour.

Prerequisites: 

In this lesson, you will:

  • Automate backups according to a regular schedule
  • Manage automation and storage space with a saving and archiving cycle

Create the Schedule custom resource

In a production environment, backups should be performed automatically and regularly. OADP supports this via the Schedule custom resource. The following example creates a schedule to perform a metadata-only backup every hour at 22 minutes past the hour.

To create this resource, define a YAML file containing the Schedule specification, which includes standard Backup configuration fields along with a cron expression. Once defined, apply this to the cluster using the oc apply command, just like any other standard Kubernetes resource.

cat << EOF > $BASE_DIR/data/install/oadp-schedule.yaml
apiVersion: velero.io/v1
kind: Schedule
metadata:
  name: daily-metadata-backup-schedule
  namespace: openshift-adp
spec:
  # 1. Define the backup schedule using a Cron expression
  # This example runs at 22 minutes past every hour
  schedule: 22 * * * *

  # 2. Define the backup specification template
  # This template is identical to the manual 'Backup' object
  template:
    spec:
      includedNamespaces:
        - demo
      includeClusterResources: true
      # CRITICAL: Only back up metadata
      snapshotVolumes: false
      storageLocation: default
      # Set the retention policy for backups created by this schedule
      ttl: 720h0m0s # (30 days * 24 hours = 720 hours)
EOF

oc apply -f $BASE_DIR/data/install/oadp-schedule.yaml

OADP will automatically create Backup objects based on this schedule (e.g., daily-metadata-backup-schedule-20250730012200) and delete them when they are set to expire.

Congratulations. You’ve automated and managed your metadata backups. It's time to learn how Red Hat Ansible Automation Platform can automate the full disaster recovery workflow.

Previous resource
The recovery process
Next resource
Automate disaster recovery