$ oc get backupStorageLocations -n openshift-adp
The schedule operation allows you to create a backup of your data at a particular time, specified by a Cron expression.
You schedule backups by creating a Schedule
custom resource (CR) instead of a Backup
CR.
Leave enough time in your backup schedule for a backup to finish before another backup is created. For example, if a backup of a namespace typically takes 10 minutes, do not schedule backups more frequently than every 15 minutes. |
You must install the OpenShift API for Data Protection (OADP) Operator.
The DataProtectionApplication
CR must be in a Ready
state.
Retrieve the backupStorageLocations
CRs:
$ oc get backupStorageLocations -n openshift-adp
NAMESPACE NAME PHASE LAST VALIDATED AGE DEFAULT
openshift-adp velero-sample-1 Available 11s 31m
Create a Schedule
CR, as in the following example:
$ cat << EOF | oc apply -f -
apiVersion: velero.io/v1
kind: Schedule
metadata:
name: <schedule>
namespace: openshift-adp
spec:
schedule: 0 7 * * * (1)
template:
hooks: {}
includedNamespaces:
- <namespace> (2)
storageLocation: <velero-sample-1> (3)
defaultVolumesToFsBackup: true (4)
ttl: 720h0m0s (5)
EOF
To schedule a backup at specific intervals, enter the
Enter the minutes value between quotation marks ( |
1 | cron expression to schedule the backup, for example, 0 7 * * * to perform a backup every day at 7:00. |
2 | Array of namespaces to back up. |
3 | Name of the backupStorageLocations CR. |
4 | Optional: In OADP version 1.2 and later, add the defaultVolumesToFsBackup: true key-value pair to your configuration when performing backups of volumes with Restic. In OADP version 1.1, add the defaultVolumesToRestic: true key-value pair when you back up volumes with Restic. |
5 | The ttl field defines the retention time of the created backup and the backed up data. For example, if you are using Restic as the backup tool, the backed up data items and data contents of the persistent volumes (PVs) are stored until the backup expires. But storing this data consumes more space in the target backup locations. An additional storage is consumed with frequent backups, which are created even before other unexpired completed backups might have timed out. |
Verify that the status of the Schedule
CR is Completed
after the scheduled backup runs:
$ oc get schedule -n openshift-adp <schedule> -o jsonpath='{.status.phase}'