mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 21:46:22 +01:00
72 lines
1.9 KiB
Plaintext
72 lines
1.9 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * backup_and_restore/application_backup_and_restore/backing_up_and_restoring/backing-up-applications.adoc
|
|
|
|
:_content-type: PROCEDURE
|
|
[id="oadp-scheduling-backups_{context}"]
|
|
= Scheduling backups
|
|
|
|
You schedule backups by creating a `Schedule` custom resource (CR) instead of a `Backup` CR.
|
|
|
|
[WARNING]
|
|
====
|
|
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.
|
|
====
|
|
|
|
.Prerequisites
|
|
|
|
* You must install the OpenShift API for Data Protection (OADP) Operator.
|
|
* The `DataProtectionApplication` CR must be in a `Ready` state.
|
|
|
|
.Procedure
|
|
|
|
. Retrieve the `backupStorageLocations` CRs:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get backupStorageLocations
|
|
----
|
|
+
|
|
.Example output
|
|
+
|
|
[source,terminal]
|
|
----
|
|
NAME PHASE LAST VALIDATED AGE DEFAULT
|
|
velero-sample-1 Available 11s 31m
|
|
----
|
|
|
|
. Create a `Schedule` CR, as in the following example:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
$ 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>
|
|
defaultVolumesToRestic: true <4>
|
|
ttl: 720h0m0s
|
|
EOF
|
|
----
|
|
<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: Add the `defaultVolumesToRestic: true` key-value pair if you are backing up volumes with Restic.
|
|
|
|
. Verify that the status of the `Schedule` CR is `Completed` after the scheduled backup runs:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get schedule -n openshift-adp <schedule> -o jsonpath='{.status.phase}'
|
|
----
|