Back up the old cluster
- Deploy the 1st cluster then install Longhorn system and Velero.
- Deploy some workloads using Longhorn volumes then write some data:
- A simple pod using multiple volumes. And some volumes are using backing images.
- A StatefulSet.
- A Deployment with a RWX volume.
- Config some recurring policies for the volumes.
- Create backups for all volumes.
- Create a cluster backup via Velero.
velero backup create lh-cluster --exclude-resources persistentvolumes,persistentvolumeclaims,backuptargets.longhorn.io,backupvolumes.longhorn.io,backups.longhorn.io,nodes.longhorn.io,volumes.longhorn.io,engines.longhorn.io,replicas.longhorn.io,backingimagedatasources.longhorn.io,backingimagemanagers.longhorn.io,backingimages.longhorn.io,sharemanagers.longhorn.io,instancemanagers.longhorn.io,engineimages.longhorn.io
Restore to a new cluster
- Deploy the 2nd cluster then install Velero only. You can try with different cluster config (more nodes or disks) here.
- Restore the cluster backup. e.g.,
velero restore create --from-backup lh-cluster
- Removing all old instance manager pods and backing image manager pods from namespace
longhorn-system
. Since there is no corresponding InstanceManager CR or BackingImageManager CR for these old pods. - Re-config nodes and disks for the restored Longhorn system if necessary.
- Re-create backing images.
- Restore all Longhorn volumes from the remote backup target.
- Update the access mode to
ReadWriteMany
since all restored volumes are modeReadWriteOnce
by default. - Create PVCs and PVs with previous names for the restored volumes.
- Verify all workloads work fine with correct data.
GitHub issue link: https://github.com/longhorn/longhorn/issues/3367