Kubernetes – K3s etcd scheduled backup to S3/Minio

k3s logo


K3s, as a lightweight Kubernetes distribution, packs a surprising amount of features. Among them, a etcd backup and restore feature.

To perform a single etcd dump:

k3s etcd-snapshot save /path/to/etcd-snapshot.db

To then perform a restore from the same etcd dump, when… (you know)

k3s server --cluster-reset \

If you, however, want to properly backup and store the etcd-dump file (off-site). S3 or Minio (or even perhaps other S3 compatible endpoints) is a nice and simple option.

The following k3s server options maintains a backup to an Minio endpoint, on a cron schedule 00:00 Every Sunday to a bucket named k3s:

k3s server --etcd-snapshot-schedule-cron '0 0 * * 0' \
--etcd-s3 \
--etcd-snapshot-schedule-cron '0 0 * * 0' \
--etcd-s3-endpoint minio.endpoint.example.com \
--etcd-s3-access-key MINIO_ACCESS_KEY \
--etcd-s3-secret-key MINIO_SECRET_KEY \
--etcd-s3-bucket k3s

Stay safe.

Leave a Reply

Your email address will not be published. Required fields are marked *