KOTS Snapshots - Disaster Recovery 101

Treva Williams
 | 
Mar 18, 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 that your 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 KOTS snapshots feature enables you to create, manage, and restore from both partial and full snapshots from the Replicated vendor portal on-demand.

Using the Snapshot feature

Before you can create a snapshot you will first need to verify that the snapshot feature has been enabled in the Vendor Portal. The option to enable snapshots is found under the Customers 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:

[.pre]kubectl kotsvelero[.pre]

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

Creating Snapshots

There are two options of snapshots you can create – Full Snapshots (formerly known as instance snapshots) and Partial Snapshots (formerly known as Application snapshots). Full snapshots create backups of everything, whereas partial snapshots only backup application volumes and application manifests – and are only able to be initialized from the admin panel. It is highly recommended that the Full Snapshot option be used for creating backups, so that’s what we’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:

[.pre]$ kubectl kots backup --namespace my-awesome-app[.pre]

Restoring from a backup

Restoarations

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

[.pre]$ kubectl kots restore --from-backup my-awesome-app-20210311[.pre]

As with backups, restore speeds will vary depending on backup size, network speed, etc, so give it a few moments to complete. Once it’s done, 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.