31 lines
1.6 KiB
Markdown
31 lines
1.6 KiB
Markdown
|
# Longhorn notes
|
||
|
|
||
|
## Creation of new Longhorn volumes
|
||
|
|
||
|
While it seems handy to use a K8s StorageClass for Longhorn, we do *not* want to use that.
|
||
|
If you use a StorageClass, a PV and Longhorn volume will be automatically provisioned.
|
||
|
These will have the name `pvc-<UID of PVC>`, where the UID of the PVC is random.
|
||
|
This makes it hard to restore a backup to a Longhorn volume with the correct name.
|
||
|
|
||
|
Instead, we want to manually create the Longhorn volumes via the web UI.
|
||
|
Then, we can create the PV and PVC as usual using our K8s provisioning tool (e.g. Kubectl/Kubenix).
|
||
|
|
||
|
Follow these actions to create a Volume:
|
||
|
1. Using the Longhorn web UI, create a new Longhorn volume, keeping the following in mind:
|
||
|
- The size can be some more than what we expect to reasonable use. We use storage-overprovisioning, so the total size of volumes can exceed real disk size.
|
||
|
- The number of replicas should be 2.
|
||
|
2. Create the PV, PVC and workload as usual.
|
||
|
|
||
|
## Disaster recovery using Longhorn backups
|
||
|
|
||
|
Backing up Longhorn volumes is very easy, but restoring them is more tricky.
|
||
|
We consider here the case when all our machines are wiped, and all we have left is Longhorn backups.
|
||
|
To restore a backup, perform the following actions:
|
||
|
1. Restore the latest snapshot in the relevant Longhorn backup, keeping the following in mind:
|
||
|
- The name should remain the same (i.e. the one chosen at Longhorn volume creation).
|
||
|
- The number of replicas should be 2.
|
||
|
- Disable recurring jobs.
|
||
|
2. Enable the "backup-nfs" recurring job for the Longhorn volume.
|
||
|
3. Disable the "default" recurring job group for the Longhorn volume.
|
||
|
4. Create the PV, PVC and workload as usual.
|