Backup and Restore with Velero
Backup and Restore
You can create backups to safeguard your SwaggerHub On-Premise data and settings. These backups can be helpful in the following situations:
To protect your data in the event of a Virtual Machine malfunction or failure.
To transfer your data to a new SwaggerHub On-Premise instance (for example, when switching hypervisors).
Swaggerhub On-premise is delivered via Kubernetes cluster: on a standalone Virtual Machine or integrated into an existing Kubernetes cluster.
To ensure data protection and facilitate recovery in case of system disruptions, it is strongly advised to employ Velero, an open-source tool designed for backing up and restoring Kubernetes clusters.
Velero supports both manual and automated backup schedules and comes equipped with a handy command-line interface (CLI) for convenient management. These backups can be stored in various locations, including cloud storage providers like:
Amazon Web Services (AWS)
Microsoft Azure
Google Cloud Platform (GCP)
network file servers (NFS)
Before using Velero, verify its compatibility with the version of KOTS installed on your Kubernetes cluster. To ascertain the KOTS version of your SwaggerHub instance:
Navigate to the Admin Console.
Locate the version displayed at the bottom.
For updated information on supported and compatible Velero versions for specific KOTS versions, refer to the Understanding Backup and Restore documentation on Replicated Docs.
To learn more about using Velero, go to Snapshot Guide and Velero documentation.
What Data is Backed up
Note
We recommend our customers to always complete a Full Snapshot of their instance and not a Partial Snapshot.
There are two kinds of snapshots you can create:
Full snapshots - backs up your SwaggerHub data and cluster information
Partial snapshots - backs up your SwaggerHub application data only
For more information, go to Replicated documentation on What Data is Backed Up.
SwaggerHub versions
You can restore a backup only to the same SwaggerHub version that created it. For example, you can't restore a backup from version 2.3.0+111 to version 2.3.1+111 or 2.4.0+118. KOTS doesn't support redeploying or downgrading to a previous SwaggerHub version because upgrades may include data migrations.
External databases
Velero doesn't back up external databases. You need to create separate backups for those databases.
Embedded Kubernetes Cluster
VM installations with embedded clusters include pre-installed Velero, accessible through the Admin Console.
Note
VM-level snapshots created in the hypervisor are not supported as the backup and restore method for VM-based installations of SwaggerHub On-Premise 2.x.
Existing Kubernetes clusters
Existing cluster installations don't include a built-in backup and restore tool. We recommend Velero as your backup and restore solution.
Deploy Velero as a Pod within the cluster, rather than on each node, to simplify management and reduce resource use. For detailed installation instructions, see Install the Velero CLI in an Online Cluster.
Backup and Restore
We advise you to create a complete backup of your SwaggerHub On-Premise system. This encompasses both your application and the KOTS/Admin Console configuration. With a full backup, you can:
Restore application and admin console data
Restore only application data
Restore only admin console data
for more information, go to Understanding Backup and Restore.
Storage Settings
Before taking a backup, you need to configure Velero with a location to store the backup files. This ensures secure storage and easy access to your backup data for restoration.
For instructions on how to configure the storage destination, go to Update Storage Settings.
Warning
We recommend against using the Internal Storage option because unrecoverable installation problems result in data loss.
Create a Full Backup
Create a backup in the Admin Console:
Login to Admin Console.
Go to Snapshots and navigate to Full Snapshots (Instance).
Click Start a snapshot.
(Alternative) Create a Backup from the CLI:
kubectl kots backup --namespace <namespace>
Scheduling backups
Schedule your backup:
Login to Admin Console.
Go to Snapshots and navigate to Settings & Schedule
Select Full snapshot (Instance) or Partial snapshots (Application)
Tick Enable automatic scheduled snapshots.
Configure the automatic backup schedule. Select one from the following options as Schedule: Hourly, Daily, Weekly, Custom.
For more information, go to Scheduled backup.
Restore Backups
Restore Full Backup
Restore a full backup from the Admin Console.
Restore a full backup from the Admin Console.
Go to Snapshots and navigate to Full Snapshots (Instance).
Select the backup you want to restore.
Click the Restore from this backup (circular button).
Copy and run the command in CLI.
(Alternative) Restore a full backup from the CLI.
When KOTS is installed on a cluster, use the following command to retrieve a list of existing backups:
kubectl kots get backup
To start restoring, use the following command. Use your backup name.
kubectl kots restore --from-backup <backup-name>
To check a list of restored backups, use the following command:
kubectl kots restore ls