Backup & Restore
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.
#Backing up a vcluster
Make sure to install the velero cli, velero server components and run the following command:
Verify backup was created successfully with:
This should create a similar output to:
#Restoring a vcluster
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.
#Using velero inside vcluster
To use velero for making backups you need to enable the
hostpath-mapper component of vcluster. You can do this by adding this to your values.yaml file when creating or upgrading the vcluster
This will start a the vcluster component for mapping the correct hostpaths as a
Once done you need to install velero cli as explained above and then connect to your vcluster, and install velero:
Make sure to fill up the appropriate fields like
secret-fileetc. depending on your installation.
Once the installation is complete you can check the status of the velero resources:
Now you're ready to create a backup using
Wait for the backup to complete and eventually you should see the following: