Backup and restore k3s kubernetes cluster with velero

Recently for my home, I’ve migrated from docker to k3s cluster. However, in the beginning, it was a standalone master with an agent connected to it. Later on I wanted to migrate to HA, however for now it’s not possible to do so natively with k3s.

And here comes in play Velero .

With Velero, you can back up and restore your cluster on s3 compatible storage (I am using scaleway) which permits you to replicate or migrate your kubernetes provider without any major issues.

Download and install velero executable on your machine

2tar xzvf velero-v1.4.0-linux-amd64.tar.gz
3cd velero-v1.4.0-linux-amd64/
4mv velero /usr/local/bin/

Create your s3 bucket and credentials, once that’s done, create configuration file

1echo "[default]
2aws_access_key_id = SCWXXXXXXXXXX
3aws_secret_access_key = 7970c83b-xxx-xxxx-xxx-xxxxx" > credentials-velero

Install Velero on your cluster

1velero install \
2    --provider aws \
3    --bucket k3s-akc-backup \
4    --secret-file ./credentials-velero \
5    --use-volume-snapshots=false \
6    --plugins=velero/velero-plugin-for-aws \
7    --backup-location-config region=fr-par,s3ForcePathStyle="true",s3Url=

Once that’s done, you can make a backup of your cluster with

1velero backup create full -snapshot-volumes=false