Backing up and restoring your K3s configurations
Backups and restoration of your Kubernetes objects are something to consider in production environments. This section explains how to perform these kinds of tasks for the default storage, SQLite, how to install and manage etcd on K3s, and basic resources if you are using the SQL backends of K3s.
Backups from SQLite
If you are using the default storage, SQLite, follow these steps:
Log in to your master node:
$ ssh ubuntu@NODE_IP
Stop the K3s using the following command:
$ k3s-killall.sh
Change to the
/var/lib/rancher/k3s/
directory server:$ sudo cd /var/lib/rancher/k3s
Copy the folder server inside the
k3s
folder:$ sudo cp -R /var/lib/rancher/k3s folder_of_destination
- Download this folder on another device if necessary.
Backups and restoring from the SQL database K3s backend
If you are using external storage – let’s say, for example, MySQL – you have to use a tool or the command to back up your database.