You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
Backup and Restore Workloads using KubeStash
This guide will show you how KubeStash backs up and restores volumes of various workload types (Deployment, StatefulSet, DaemonSet etc.).
Before You Begin
- You should be familiar with the following
KubeStashconcepts:
How Backup Process Works
The following diagram shows how KubeStash takes backup of the volumes of a workload. Open the image in a new tab to see the enlarged version.
The backup process consists of the following steps:
At first, a user creates a
Secret. This secret holds the credentials to access the backend where the backed up data will be stored.Then, she creates a
BackupStoragecustom resource that specifies the backend information, along with theSecretcontaining the credentials needed to access the backend.KubeStash operator watches for
BackupStoragecustom resources. When it finds aBackupStorageobject, it initializes theBackupStorageby uploading themetadata.yamlfile into the target storage.Then, she creates a
BackupConfigurationcustom resource that specifies the targeted workload, the Addon info with a specified task, etc. It also provides information about one or more repositories, each indicating a path and aBackupStoragefor storing the backed-up data.KubeStash operator watches for
BackupConfigurationobjects.Once the KubeStash operator finds a
BackupConfigurationobject, it createsRepositorywith the information specified in theBackupConfiguration.KubeStash operator watches for
Repositorycustom resources. When it finds theRepositoryobject, it InitializesRepositoryby uploadingrepository.yamlfile into thespec.sessions[*].repositories[*].directorypath specified inBackupConfiguration.Then, it creates a
CronJobfor each session with the schedule specified inBackupConfigurationto trigger backup periodically.On the next scheduled slot, the
CronJobtriggers a backup by creating aBackupSessioncustom resource.KubeStash operator watches for
BackupSessioncustom resources.When it finds a
BackupSessionobject, it creates aSnapshotcustom resource for eachRepositoryspecified in theBackupConfiguration.Then it resolves the respective
AddonandFunctionand prepares backupJob(s) definition.Then, it mounts the targeted workload volume(s) into the
Job(s) and creates it/them.The
Job(s) takes backup of the targeted workload.After the backup process is completed, the backup
Job(s) updates thestatus.components[*]field of theSnapshotresources with backup information of the target application components.
How Restore Process Works
The following diagram shows how KubeStash restores backed up data inside a workload. Open the image in a new tab to see the enlarged version.
The restore process consists of the following steps:
At first, the user creates a workload where the data will be restored or the user can use the same workload.
Then, she creates a
RestoreSessioncustom resource that specifies the target workload volume(s) where the backed-up data will be restored, theRepositoryobject that points to aBackupStoragethat holds backend information, and the targetSnapshot, which will be restored. It also specifies theAddoninfo with task to use to restore the volume.KubeStash operator watches for
RestoreSessioncustom resources.When it finds a
RestoreSessioncustom resource, it resolves the respectiveAddonandFunctionand prepares a restoreJob(s) definition.The restore
Job(s) restores the backed-up data into the targeted workload volume(s).Finally, when the restore process is completed, the
Job(s) updates thestatus.components[*]field of theRestoreSessionwith restore information of the target application components.






