Backup & Restore Loft
This guide describes how to backup and restore the Loft management plane. For backing up the connected clusters, please reuse a regular Kubernetes backup solution such as velero.
Loft saves its state as Kubernetes CRD objects, these can be either backed up via velero or through a special Loft CLI command that we have created for convenience that saves all relevant Kubernetes resources to a single file. Loft CLI allows you to backup these components whenever required. Below Resources will be part of the backup:
- ClusterRoleTemplates
- ClusterAccesses
- SpaceConstraints
- Users
- Teams
- SharedSecrets
- AccessKeys
- Apps
- SpaceTemplates
- VirtualClusterTemplates
- Clusters & Cluster Secrets
- Projects
- VirtualClusterInstances
- SpaceInstances
- ProjectSecrets
To take a backup using the defaults, you can run the following command. This will dump the manifests of all the above listed components to a file in the current directory named 'backup.yaml'
loft backup
Alternatively, you may specify the name for the backup file by running the command as:
loft backup --filename loft-backup.yaml
In some scenarios, Loft may have been installed in a different namespace instead of the default 'loft' namespace. You can provide this to the command as below:
loft backup --namespace my-namespace
You can also choose to exclude certain components from the backup by supplying the names as a comma-seperated string like below. This will exclude users and teams from the backup.
loft backup --skip users,teams
Restoring Loft from backup
The backup YAML file contains the manifests for the resources of the Loft Management plane. Hence, it can be used as any other Kubernetes manifest file. To restore, simply apply the backup to your cluster using the below command:
kubectl apply -f <backup-filename>.yaml
Make sure that not 2 Kubernetes clusters run the same Loft resources at the same time as this can lead to conflicts in reconciliation and could cause problems.