Velero’s backup and restore capabilities make it a valuable tool for migrating your data between clusters. Cluster migration with Velero is based on Velero’s object storage sync functionality, which is responsible for syncing Velero resources from your designated object storage to your cluster. This means that to perform cluster migration with Velero you must point each Velero instance running on clusters involved with the migration to the same cloud object storage location.
This page outlines a cluster migration scenario and some common configurations you will need to start using Velero to begin migrating data.
Before migrating you should consider the following,
This scenario steps through the migration of resources from Cluster 1 to Cluster 2. In this scenario, both clusters are using the same cloud provider, AWS, and Velero’s AWS plugin.
On Cluster 1, make sure Velero is installed and points to an object storage location using the
velero install --provider aws --image velero/velero:v1.8.0 --plugins velero/velero-plugin-for-aws:v1.4.0 --bucket velero-migration-demo --secret-file xxxx/aws-credentials-cluster1 --backup-location-config region=us-east-2 --snapshot-location-config region=us-east-2
During installation, Velero creates a Backup Storage Location called
default inside the
--bucket your provided in the install command, in this case
velero-migration-demo. This is the location that Velero will use to store backups. Running
velero backup-location get will show the backup location of Cluster 1.
velero backup-location get NAME PROVIDER BUCKET/PREFIX PHASE LAST VALIDATED ACCESS MODE DEFAULT default aws velero-migration-demo Available 2022-05-13 13:41:30 +0800 CST ReadWrite true
Still on Cluster 1, make sure you have a backup of your cluster. Replace
<BACKUP-NAME> with a name for your backup.
velero backup create <BACKUP-NAME>
Alternatively, you can create a
scheduled backup of your data with the Velero
schedule operation. This is the recommended way to make sure your data is automatically backed up according to the schedule you define.
The default backup retention period, expressed as TTL (time to live), is 30 days (720 hours); you can use the
--ttl <DURATION> flag to change this as necessary. See
how velero works for more information about backup expiry.
On Cluster 2, make sure that Velero is installed. Note that the install command below has the same
--bucket location as the install command for Cluster 1. The Velero plugin for AWS does not support migrating data between regions.
velero install --provider aws --image velero/velero:v1.8.0 --plugins velero/velero-plugin-for-aws:v1.4.0 --bucket velero-migration-demo --secret-file xxxx/aws-credentials-cluster2 --backup-location-config region=us-east-2 --snapshot-location-config region=us-east-2
Alternatively you could configure
VolumeSnapshotLocations after installing Velero on Cluster 2, pointing to the
--bucket location and
region used by Cluster 1. To do this you can use to
velero backup-location create and
velero snapshot-location create commands.
velero backup-location create bsl --provider aws --bucket velero-migration-demo --config region=us-east-2 --access-mode=ReadOnly
Its recommended that you configure the
BackupStorageLocations as read-only
by using the
--access-mode=ReadOnly flag for
velero backup-location create. This will make sure that the backup is not deleted from the object store by mistake during the restore. See
velero backup-location –help for more information about the available flags for this command.
velero snapshot-location create vsl --provider aws --config region=us-east-2
velero snapshot-location –help for more information about the available flags for this command.
Continuing on Cluster 2, make sure that the Velero Backup object created on Cluster 1 is available.
<BACKUP-NAME> should be the same name used to create your backup of Cluster 1.
velero backup describe <BACKUP-NAME>
Velero resources are
synchronized with the backup files in object storage. This means that the Velero resources created by Cluster 1’s backup will be synced to Cluster 2 through the shared Backup Storage Location. Once the sync occurs, you will be able to access the backup from Cluster 1 on Cluster 2 using Velero commands. The default sync interval is 1 minute, so you may need to wait before checking for the backup’s availability on Cluster 2. You can configure this interval with the
--backup-sync-period flag to the Velero server on Cluster 2.
On Cluster 2, once you have confirmed that the right backup is available, you can restore everything to Cluster 2.
velero restore create --from-backup <BACKUP-NAME>
<BACKUP-NAME> is the same backup name from Cluster 1.
Check that the Cluster 2 is behaving as expected:
On Cluster 2, run:
velero restore get
velero restore describe <RESTORE-NAME-FROM-GET-COMMAND>
Your data that was backed up from Cluster 1 should now be available on Cluster 2.
If you encounter issues, make sure that Velero is running in the same namespace in both clusters.