You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
How Stash Backups Kubernetes Resources
Stash v2023.10.9 supports taking backup of Kubernetes resource YAMLs. You can backup the YAML definition of the resources of entire cluster, a particular namespaces, or only an application etc. In this guide, we are going to show you how Kubernetes resource backup works in Stash.
How Backup Works
The following diagram shows how Stash takes backup of the Kubernetes resources. 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
Repositorycrd that specifies the backend information along with the secret that holds the credentials to access the backend.Then, she creates a
BackupConfigurationcrd which specifies theTaskto use to backup the the resources.Stash operator watches for
BackupConfigurationcrd.Once Stash operator finds a
BackupConfigurationcrd, it creates a CronJob with the schedule specified inBackupConfigurationobject to trigger backup periodically.On the next scheduled slot, the CronJob triggers a backup by creating a
BackupSessioncrd.Stash operator also watches for
BackupSessioncrd.When it finds a
BackupSessionobject, it resolves the respectiveTaskandFunctionand prepares a Job definition to backup.Then, it creates the Job to backup the desired resource YAMLs.
Then, the Job dumps the Kubernetes Resource YAML, and store them temporarily in a directory.Then, it upload the content of the directory to the cloud backend.
Finally, when the backup is complete, the Job sends Prometheus metrics to the Pushgateway running inside Stash operator pod. It also updates the
BackupSessionandRepositorystatus to reflect the backup procedure.






