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 v2022.07.09 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.

  KubeDump Backup Overview
Fig: KubeDump Backup Overview

The backup process consists of the following steps:

  1. At first, a user creates a secret with access credentials of the backend where the backed up data will be stored.

  2. Then, she creates a Repository crd that specifies the backend information along with the secret that holds the credentials to access the backend.

  3. Then, she creates a BackupConfiguration crd which specifies the Task to use to backup the the resources.

  4. Stash operator watches for BackupConfiguration crd.

  5. Once Stash operator finds a BackupConfiguration crd, it creates a CronJob with the schedule specified in BackupConfiguration object to trigger backup periodically.

  6. On the next scheduled slot, the CronJob triggers a backup by creating a BackupSession crd.

  7. Stash operator also watches for BackupSession crd.

  8. When it finds a BackupSession object, it resolves the respective Task and Function and prepares a Job definition to backup.

  9. Then, it creates the Job to backup the desired resource YAMLs.

  10. 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.

  11. Finally, when the backup is complete, 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.

Next Steps

  • Backup the YAMLs of your entire Kubernetes cluster using Stash following the guide from here.
  • Backup the YAMLs of an entire Namespace using Stash following the guide from here.
  • Backup the YAMLs of a particular application using Stash following the guide from here.