From a7f6614be86d4d93e8868e5989b19ff9fcffa014 Mon Sep 17 00:00:00 2001 From: David Kirwan Date: Fri, 8 Jul 2022 13:40:48 +0100 Subject: [PATCH] Openshift: SOP to restore/backup/migrate/disaster recovery with Velero --- modules/ocp4/pages/sop_velero.adoc | 76 ++++++++++++++++++++++++++++++ modules/ocp4/pages/sops.adoc | 1 + 2 files changed, 77 insertions(+) create mode 100644 modules/ocp4/pages/sop_velero.adoc diff --git a/modules/ocp4/pages/sop_velero.adoc b/modules/ocp4/pages/sop_velero.adoc new file mode 100644 index 0000000..879aa62 --- /dev/null +++ b/modules/ocp4/pages/sop_velero.adoc @@ -0,0 +1,76 @@ += SOP Velero +This SOP should be used in the following scenario: + +- Performing a data migration between OpenShift clusters. +- Performing a data backup to S3 +- Velero doesn't support restoring into a cluster with a lower Kubernetes version than where the backup was taken. + +== Resources +- [1] https://velero.io/docs/main/migration-case/[Migrating between OpenShift clusters using Velero] + + +== Steps +1. Install the Velero CLI client. ++ +eg: ++ +---- +wget https://github.com/vmware-tanzu/velero/releases/download/v1.8.1/velero-v1.8.1-linux-amd64.tar.gz +tar -zxf velero-v1.8.1-linux-amd64.tar.gz +ln -s velero-v1.8.1-linux-amd64/velero ~/bin/velero +---- + + +2. Configure Velero to access S3 ++ +Create a file `credentials-velero` which contains the AWS access key and secret access key with permissions to access an S3 bucket. ++ +---- +[default] +aws_access_key_id=XXX +aws_secret_access_key=XXX +---- + + +3. Next install Velero in the cluster ++ +Ensure you are authenticated to the OpenShift cluster via the CLI. ++ +Using something like the following: ++ +---- +REGION="us-east-1" +S3BUCKET="fedora-openshift-migration" + +velero install \ + --provider aws \ + --plugins velero/velero-plugin-for-aws:v1.4.0 \ + --bucket $S3BUCKET \ + --backup-location-config region=$REGION \ + --snapshot-location-config region=$REGION \ + --use-volume-snapshots=true \ + --image velero/velero:v1.4.0 \ + --secret-file ./credentials-velero \ + --use-restic +---- + +4. Perform a backup ++ +eg: ++ +---- +velero backup create backupName --include-cluster-resources=true --ordered-resources 'persistentvolumes=pvName' --include-namespaces=namespaceName +---- + + +5. Restore a backup ++ +While authenticated to a second cluster to restore to, or original cluster where you are recovering to you can restore a backup like so: ++ +---- +velero backup get +velero restore create --from-backup backupName +---- + +For more information see the `Velero` documentation at [1]. + diff --git a/modules/ocp4/pages/sops.adoc b/modules/ocp4/pages/sops.adoc index fcaf445..9903d7a 100644 --- a/modules/ocp4/pages/sops.adoc +++ b/modules/ocp4/pages/sops.adoc @@ -18,4 +18,5 @@ - xref:sop_configure_openshift_virtualization_operator.adoc[SOP Configure the Openshift Virtualization Operator] - xref:sop_add_node.adoc[SOP Add an OCP4 Node to an Existing Cluster] - xref:sop_add_odf_storage.adoc[SOP Add new capacity to the OCP4 ODF Storage Cluster] +- xref:sop_velero.adoc[SOP Velero]