kine-migrate
Migrate kine (the K3s database) data from one supported backend / database to another
Building
go build .
This should result in a binary called kine-migrate
Usage
kine-migrate --from <connection string> --to <connection string>
For supported connection strings, see the k3s docs or the documentation of the library kine uses for the connection for those not mentioned there (notably sqlite).
If using sqlite, make sure to enable WAL mode by appending ?_journal=wal
to the connection string. For the default sqlite database, this would look like this:
sqlite:///var/lib/rancher/k3s/server/db/kine.db?_journal=wal
Disclaimer
I do not currently have any plans to propoerly maintain this tool.
It is here in the hope that it might be useful to someone else.
You may still open an issue if something doesn't work, but I can't guarantee that I will fix it.
I needed this exactly once to migrate my kine db from sqlite to mysql, which worked great, but it is also the only thing that has been tested.
Back up your data before using this tool.
Double-check if you have --from and --to set in the correct direction.
I am not responsible if you somehow manage to delete your database with this.