title | description | menu | product_name | menu_name | section_menu_id | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Stand-alone Volume Backup Overview | Stash |
An overview on how stand-alone volume backup works in Stash. |
|
stash |
docs_{{ .version }} |
guides |
If you are using a volume that can be mounted in multiple workloads, aka ReadWriteMany
/RWX
, you might want to backup the volume independent of the workloads. Stash supports backup of stand-alone volumes. This guide will give you an overview of how stand-alone volume backup and restore process works in Stash.
The following diagram shows how Stash takes backup of a stand-alone volume. Open the image in a new tab to see the enlarged version.
Fig: Stand-alone Volume Backup OverviewThe backup process consists of the following steps:
-
At first, a user creates a secret with access credentials of the backend where the backed up data will be stored.
-
Then, she creates a
Repository
crd that specifies the backend information along with the secret that holds the credentials to access the backend. -
Then, she creates a
BackupConfiguration
crd targeting the volume. TheBackupConfiguration
object also specifies theTask
to use to backup the volume. -
Stash operator watches for
BackupConfiguration
crd. -
Once Stash operator finds a
BackupConfiguration
crd, it creates a CronJob with the schedule specified inBackupConfiguration
object to trigger backup periodically. -
On next scheduled slot, the CronJob triggers a backup by creating a
BackupSession
crd. -
Stash operator also watches for
BackupSession
crd. -
When it finds a
BackupSession
object, it resolves the respectiveTask
andFunction
and prepares a backup Job definition. -
Then, it mounts the targeted volume into the Job and creates it.
-
The Job takes backup of the targeted volume.
-
Finally, when backup is completed, the Job sends Prometheus metrics to the Pushgateway running inside Stash operator pod. It also updates the
BackupSession
andRepository
status to reflect the backup procedure.
The following diagram shows how Stash restores backed up data into a stand-alone volume. Open the image in a new tab to see the enlarged version.
Fig: Stand-alone Volume Restore OverviewThe restore process consists of the following steps:
-
At first, a user creates a
RestoreSession
crd which specifies the targeted volume where the backed up data will be restored and theRepository
crd which holds the backend information where the backed up data has been stored. It also specifies theTask
to use to restore the target. -
Stash operator watches for
RestoreSession
object. -
Once it finds a
RestoreSession
object, it resolves the respectiveTask
andFunction
and prepares a restore Job definition. -
Then, it mounts the targeted volume into the Job and creates it.
-
The Job restores the backed up data into the volume.
-
Finally, when the restore process is completed, the Job sends Prometheus metrics to the Pushgateway and update the
RestoreSession
status to reflect restore completion.
You might be wondering why we have used Function and Task to backup or restore a volume. Well, let us explain.
Function-Task
model gives you the flexibility to customize the backup/restore process. For example, it enables you to execute some logic to prepare your apps before backup or execute logic to delete corrupted data before restore. For more details about what are the others benefits of Function-Task
model, please visit here.
- Learn how to backup and restore a stand-alone PVC from here.