Rok Snapshots¶
Rok snapshots allow you to instantly snapshot your Rok volumes to create a point-in-time copy of your data for local and offsite backups. Rok takes immutable, group consistent snapshots of your applications and stores these snapshots in a backup store, for example, Amazon S3.
Combine this with Rok’s instant cloning, and you can recover from hardware failure in minutes, regardless of the volume’s capacity.
To take a volume snapshot, use the rok
volume snapshot class:
Parameters¶
If the pre-defined volume snapshot class doesn’t meet your requirements, you can create your own customized volume snapshot class, based on the pre-defined one.
Rok supports the following volume snapshot class parameters to further customize Rok snapshots:
rok/snapshot-chunk-size
- Type: string
- Values: size string
- Default: “128KiB”
The chunk size for snapshots. It defines the unit of Copy On Write for snapshots. The value must be a power of 2 between 4KiB and 512KiB.
rok/snapshot-cow-size
- Type: string
- Values: size string
- Default: “10GiB”
The size of the snapshot Copy On Write space. Increase this in case of heavy I/O during snapshots.
rok/pre-snapshot-verification
- Type: string
- Values: “true” | “false”
- Default: “true”
Verify the integrity of the filesystem on the volume, before taking a snapshot. If the filesystem has errors, Rok refuses to snapshot the volume.
rok/post-snapshot-verification
- Type: string
- Values: “true” | “false”
- Default: “false”
Verify the integrity of the filesystem in the snapshot, after creating it. This is an expensive operation that runs a full filesystem check, and may induce additional costs, since it access the snapshot data in the snapshot store, for example, S3.
Note
To affect only a specific Rok snapshot you can specify any of the volume snapshot class parameters as a VolumeSnapshot annotation.
Snapshot PVC Backed by Rok¶
Create a VolumeSnapshot object and set the VolumeSnapshotClass
to rok
:
Create Volume from a Kubernetes Snapshot¶
You can create a PVC from a Kubernetes VolumeSnapshot object. You need to have
created this object using the rok
volume snapshot class.
Create a PVC object and set dataSource
to point to the Rok snapshot:
Create PVC from a Rok Resource¶
Create a new PVC and set the rok/origin
PVC annotation to the URL of the Rok
object:
Create StatefulSet from a Rok Group Resource¶
Rok supports passing a group resource as a rok/origin
for a PVC. This is
useful when you want to create a StatefulSet with a volumeClaimTemplate
and assign a unique disk from a group resource to each Pod.
An example StatefulSet looks like this:
The order of the resources within the group is important, as each Pod will get
the corresponding disk (e.g., web-0
will get the first object from the
group, web-1
the second one, etc.).
If the number of replicas of the StatefulSet exceeds the number of the objects in the group, the extra Pods will get an empty disk.