Backing up and restoring a virtual cluster usually means to backup the namespace where vcluster is installed in. If you are using an external datastore like MySQL or Postgresql that is not running inside the same namespace as vcluster, you will need to create a separate backup for the datastore as well. Please refer to the appropriate docs for doing that.
We recommend velero to backup virtual clusters, as it supports PV backup as well as single namespace backups. Other backup solutions should usually work as well.
Make sure your cluster supports volume snapshots to allow velero to backup persistent volumes and persistent volume claims that save the virtual cluster state. Alternatively, you can use velero's restic integration to backup the virtual cluster state.
Verify backup was created successfully with:
This should create a similar output to:
After you have created a backup through either the velero cli or a schedule, you can restore a vcluster from the created backup via the velero cli:
Verify the restore process via:
This should recreate the vcluster workloads, configurations as well as vcluster state in the virtual cluster namespace.
Currently its quite difficult to move a vcluster from one namespace to another as there are objects that include a namespace reference such as the cluster role bindings or persistent volumes. velero supports namespace mapping that should work in most cases, but caution is still required as this might not work for every vcluster setup.