By default k3s deployment have a local-storage deployed. This is nice but unsupported by the File System Backup of velero.

Velero is a Kubernetes backup tool which backups manifests and optionally files. It uses either restic or kopia to backup files.

In my case, I want to migrate from an old cluster to a new one using backups to do it as seamless as possible. To do that I wanted to deploy proper backups making the migration easier.

Since Velero doesn't support hostpath like files backups (like in local-storage), we first need to migrate our PVC to those.

Migrate the volume to make it backup-able

To do that we can use the nice pv-migrate tool! First we need to create a new PVC with an appropriate storage class that we can backup. I do have one named hdd-disk which uses OpenEbs-zfs.

N.B: this needs to use the same storage class name as in your target cluster (because the pvc or pv file references it).

pv-migrate --source data-1 --dest data-2

Installing velero with Kopia

velero install \
    --provider aws \
    --plugins velero/velero-plugin-for-aws:v1.10.1 \
    --bucket $BUCKET_NAME \
    --secret-file /tmp/credentials-velero \
    --backup-location-config region=minio,s3ForcePathStyle="true",s3Url=https://minio.example.com --use-node-agent --uploader-type kopia --default-volumes-to-fs-backup

Creating a velero backup

velero backup create golinks-21 --include-namespaces=golinks

Restoring in the target cluster

velero restore create --from-backup golinks-21