1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/oadp-creating-backup-cr.adoc
Shruti Deshpande 9a10473640 Modularization work for backing-up title
Signed-off-by: Shruti Deshpande <shdeshpa@redhat.com>
2025-07-03 14:43:05 +00:00

86 lines
2.8 KiB
Plaintext

// Module included in the following assemblies:
//
// * backup_and_restore/application_backup_and_restore/backing_up_and_restoring/backing-up-applications.adoc
:_mod-docs-content-type: PROCEDURE
[id="oadp-creating-backup-cr_{context}"]
= Creating a Backup CR
To back up Kubernetes resources, internal images, and persistent volumes (PVs), create a Backup custom resource (CR).
.Prerequisites
* You must install the OpenShift API for Data Protection (OADP) Operator.
* The `DataProtectionApplication` CR must be in a `Ready` state.
* Backup location prerequisites:
** You must have S3 object storage configured for Velero.
** You must have a backup location configured in the `DataProtectionApplication` CR.
* Snapshot location prerequisites:
** Your cloud provider must have a native snapshot API or support Container Storage Interface (CSI) snapshots.
** For CSI snapshots, you must create a `VolumeSnapshotClass` CR to register the CSI driver.
** You must have a volume location configured in the `DataProtectionApplication` CR.
.Procedure
. Retrieve the `backupStorageLocations` CRs by entering the following command:
+
[source,terminal]
----
$ oc get backupstoragelocations.velero.io -n openshift-adp
----
+
.Example output
+
[source,terminal]
----
NAMESPACE NAME PHASE LAST VALIDATED AGE DEFAULT
openshift-adp velero-sample-1 Available 11s 31m
----
. Create a `Backup` CR, as in the following example:
+
[source,yaml]
----
apiVersion: velero.io/v1
kind: Backup
metadata:
name: <backup>
labels:
velero.io/storage-location: default
namespace: openshift-adp
spec:
hooks: {}
includedNamespaces:
- <namespace> <1>
includedResources: [] <2>
excludedResources: [] <3>
storageLocation: <velero-sample-1> <4>
ttl: 720h0m0s
labelSelector: <5>
matchLabels:
app=<label_1>
app=<label_2>
app=<label_3>
orLabelSelectors: <6>
- matchLabels:
app=<label_1>
app=<label_2>
app=<label_3>
----
<1> Specify an array of namespaces to back up.
<2> Optional: Specify an array of resources to include in the backup. Resources might be shortcuts (for example, 'po' for 'pods') or fully-qualified. If unspecified, all resources are included.
<3> Optional: Specify an array of resources to exclude from the backup. Resources might be shortcuts (for example, 'po' for 'pods') or fully-qualified.
<4> Specify the name of the `backupStorageLocations` CR.
<5> Map of {key,value} pairs of backup resources that have *all* of the specified labels.
<6> Map of {key,value} pairs of backup resources that have *one or more* of the specified labels.
.Verification
* Verify that the status of the `Backup` CR is `Completed`:
+
[source,terminal]
----
$ oc get backups.velero.io -n openshift-adp <backup> -o jsonpath='{.status.phase}'
----