Backup and Restore
The way K3s is backed up and restored depends on which type of datastore is used.
warning
In addition to backing up the datastore itself, you must also back up the server token file at /var/lib/rancher/k3s/server/token
.
You must restore this file, or pass its value into the --token
option, when restoring from backup.
If you do not use the same token value when restoring, the snapshot will be unusable, as the token is used to encrypt confidential data within the datastore itself.
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).