Restore Etcd in RKE2 Example

CommunityEnterprise

This example outlines a straightforward procedure to restore etcd in a Kubernetes cluster using Rancher and RKE2.

You will perform a local restore from a previous backup and mark @kubernetes/namespaces/kube-system/etcd/.

* restore where=/tmp/bacula/restores/ jobid=1
...
$ cd @kubernetes/namespaces/kube-system/
cwd is: /@kubernetes/namespaces/kube-system/
$ mark etcd
1 file marked.
$ done
...
OK to run? (Yes/mod/no): yes

Wait for the restore to complete.

root@bacula-fd:~$ cd /tmp/bacula-restores/@kubernetes/namespaces/kube-system/etcd/
scp snapshot-07-11-2024.db root@rke2-master01-bck:/root/

Access all server nodes remotely:

root@rke2-master01-bck:~$ systemctl stop rke2-server

Access the first server node (the one without a server tag in the rke2 config), run the cluster reset:

root@rke2-master01-bck:~$ rke2 server --cluster-reset --cluster-reset-restore-path=/root/snapshot-07-11-2024.db
...
systemctl start rke2-server

On the other server nodes, remove the RKE2 database directory and then start the service:

rm -rf /var/lib/rancher/rke2/server/db
systemctl start rke2-server

After restoring etcd, you may need to restart some services (e.g., Longhorn or Harbor) for them to function properly.

Go back to: Restore Examples.