Skip to content
Mementropy
Lab NotesHomelab notebookField note

Restoring a deleted ConfigMap from a NAS backup of the K3s datastore

I deleted a test ConfigMap and recovered it from the Restic snapshot on the NAS.

By Ryan Hammang

I wanted proof that the K3s backup on my NAS could bring something back, before I trusted it with anything real.

Single-node K3s keeps its state in an SQLite database. So the drill went like this:

  1. Create a test ConfigMap called backup-drill-20261017, with a value I could look for later.
  2. Run the backup script. It takes an online SQLite .backup of state.db, checks it with PRAGMA integrity_check (it said ok), and copies the K3s config, server token, encryption config and TLS files.
  3. Send all of that to the NAS as an encrypted Restic snapshot. It was 52 files, 12.9 MiB, and 2.6 MiB after compression.
  4. Delete the ConfigMap from the live cluster.
  5. Restore the snapshot from the NAS into a temp folder and query the kine table in the restored state.db for the ConfigMap’s key.

It was there:

RESTORE DRILL PASSED: recovered /registry/configmaps/default/backup-drill-20261017

This proves the data comes back from the NAS. It doesn’t yet prove a full cluster rebuild from that file. That’s a bigger drill, and I want to do it before I depend on this.

How do you test K3s restores? Do you rebuild a whole node, or check the datastore like this?

Recipes written later from this work: