KOTS Snapshots – Disaster Recovery 101

Treva Williams
 | 
Mar 16, 2021
disaster recovery

They say, “An ounce of preparation is better than a pound of cure.”This holds true for many situations, none more so than making sure thatyour organization is prepared in the dreaded event that something – whether it be an HSD, a fire, a spilled drink, or a flock of wild pigeons – takes down one or more of your servers. Though Kubernetes has made disaster recovery a bit less traumatic than back in The Olde Days, there’s still room for improvement of the disaster recovery process.  

Thus, we have KOTS Snapshots – yet another Replicated KOTS feature to keep your cluster up and running. Powered by Velero,an open-source Kubernetes backup and restoration tool, the KOTSsnapshots feature enables you to create, manage, and restore from bothpartial and full snapshots from the Replicated vendor portal on-demand.

Using the Snapshot feature

Before you can create a snapshot youwill first need to verify that the snapshot feature has been enabled inthe Vendor Portal. The option to enable snapshots is found under theCustomers tab, under the “License options” section.

license options

Once snapshots are enabled, add a backup resource to your application to show the option to create a snapshot in the admin panel. The backup resource supports KOTS optional resources, however, the yaml below is sufficient as a minimal spec to enable the backup function:

[.pre]apiVersion: velero.io/v1kind: Backupmetadata:name: backupspec: {}[.pre]

You will then need to configure a storage backend that exists outside of the cluster. Storage backends can either be set from the admin panel or by using the CLI command:

kubectl kots velero

Once the storage backend is set, you are then ready to create your first snapshot.

Creating Snapshots

There are two options of snapshots youcan create – Full Snapshots (formerly known as instance snapshots) andPartial Snapshots (formerly known as Application snapshots). Fullsnapshots create backups of everything, whereas partial snapshots onlybackup application volumes and application manifests – and are only ableto be initialized from the admin panel. It is highly recommended thatthe Full Snapshot option be used for creating backups, so that’s whatwe’ll be doing in this tutorial.

snapshots

Backups can be created through the admin panel as shown in the screenshot above or using the kubectl kots CLI. For example, let’s create a full backup for “my-awesome-app” using kots CLI:

$ kubectl kots backup --namespace my-awesome-app

Restoring from a backup

Restoarations

Restorations from a full snapshot are initialized using the kubectl kotsCLI, but you can receive a command to start a partial or fullrestoration from the admin panel by clicking the “Restore” icon next tothe backup you would like to restore from. I want to do a full restoreusing a backup named my-awesome-app-20210311, so my command will look like this:

$ kubectl kots restore --from-backup my-awesome-app-20210311

Aswith backups, restore speeds will vary depending on backup size,network speed, etc, so give it a few moments to complete. Once it’sdone, it can be used to make either partial or full restorations.

To learn more about how KOTS (Kubernetes Off-The-Shelf) can safeguard your application with disaster recovery, schedule a demo today.