Running a K3s restore drill with a test ConfigMap
Prove a K3s datastore backup brings data back.
What it’s for
Section titled “What it’s for”Proving that a K3s SQLite backup on the NAS contains real cluster objects.
What you need
Section titled “What you need”- The backup from the previous recipe
- Create a marker:
kubectl create configmap backup-drill-$(date +%Y%m%d) \ --from-literal=sentinel=restore-verified- Run the backup.
- Delete the marker from the live cluster.
- Restore the latest snapshot to a temp folder:
restic -r rclone:nas:<share>/<host>/restic restore latest --target /tmp/restore-drill- Look for the marker’s key in the restored datastore:
sqlite3 /tmp/restore-drill/<path>/state.db \ "SELECT name FROM kine WHERE name LIKE '/registry/configmaps/default/backup-drill-%';"- Remove the temp folder.
Check it worked
Section titled “Check it worked”The query returns the marker’s key.
Traps seen
Section titled “Traps seen”- This proves the data is in the backup. It doesn’t prove a full node rebuild. Do that drill separately.