You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
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.
The 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. The BackupConfiguration
object also specifies the Task
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 in BackupConfiguration
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 respective Task
and Function
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
and Repository
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.
The 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 the Repository
crd which holds the backend information where the backed up data has been stored. It also specifies the Task
to use to restore the target.
Stash operator watches for RestoreSession
object.
Once it finds a RestoreSession
object, it resolves the respective Task
and Function
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.