Backing up Rancher
In this section, you'll learn how to back up Rancher running on any Kubernetes cluster. To backup Rancher installed with Docker, refer to the instructions for single node backups.
The backup-restore operator needs to be installed in the local cluster, and only backs up the Rancher app. The backup and restore operations are performed only in the local Kubernetes cluster.
Note that the rancher-backup operator version 1.x.x is for Rancher v2.5.x.
When restoring a backup into a new Rancher setup, the version of the new setup should be the same as the one where the backup is made. The Kubernetes version should also be considered when restoring a backup, since the supported apiVersion in the cluster and in the backup file could be different.
Rancher version must be v2.5.0 and up
1. Install the
The backup storage location is an operator-level setting, so it needs to be configured when
rancher-backup is installed or upgraded.
Backups are created as .tar.gz files. These files can be pushed to S3 or Minio, or they can be stored in a persistent volume.
- In the Rancher UI, go to the Cluster Explorer view for the local cluster.
- Click Apps.
- Click Rancher Backups.
- Configure the default storage location. For help, refer to the storage configuration section.
NOTE: There are two known issues in Fleet that occur after performing a restoration using the backup-restore-operator: Fleet agents are inoperable and clientSecretName and helmSecretName are not included in Fleet gitrepos. Refer here for workarounds.
2. Perform a Backup
To perform a backup, a custom resource of type Backup must be created.
In the Cluster Explorer, go to the dropdown menu in the upper left corner and click Rancher Backups.
Create the Backup with the form, or with the YAML editor.
For configuring the Backup details using the form, click Create and refer to the configuration reference and to the examples.
For using the YAML editor, we can click Create > Create from YAML. Enter the Backup YAML. This example Backup custom resource would create encrypted recurring backups in S3. The app uses the
credentialSecretNamespacevalue to determine where to look for the S3 backup secret:
schedule: "@every 1h"
Note: When creating the Backup resource using YAML editor, the
resourceSetNamemust be set to
For help configuring the Backup, refer to the configuration reference and to the examples.
rancher-backupoperator doesn't save the EncryptionConfiguration file. The contents of the EncryptionConfiguration file must be saved when an encrypted backup is created, and the same file must be used when restoring from this backup.
Result: The backup file is created in the storage location configured in the Backup custom resource. The name of this file is used when performing a restore.