Backup and Restore
The way K3s is backed up and restored depends on which type of datastore is used.
In addition to backing up the datastore itself, you must also back up the server token file at |
Backup and Restore with SQLite
No special commands are required to back up or restore the SQLite datastore.
-
To back up the SQLite datastore, take a copy of
/var/lib/rancher/k3s/server/db/
. -
To restore the SQLite datastore, restore the contents of
/var/lib/rancher/k3s/server/db
(and the token, as discussed above).
Backup and Restore with External Datastore
When an external datastore is used, backup and restore operations are handled outside of K3s. The database administrator will need to back up the external database, or restore it from a snapshot or dump.
We recommend configuring the database to take recurring snapshots.
For details on taking database snapshots and restoring your database from them, refer to the official database documentation:
Backup and Restore with Embedded etcd Datastore
See the k3s etcd-snapshot
command documentation for information on performing backup and restore operations on the embedded etcd datastore.