This message was deleted.
# k3s
a
This message was deleted.
b
On a side quest I've tried to open the underlying sqlite db directly:
Copy code
sqlite state.db <<< ".tables"
Unable to open database "state.db": file is encrypted or is not a database
In the "backup/restore" docs there is a note:
In addition to backing up the datastore itself, you must also back up the server token file at /var/lib/rancher/k3s/server/token
Should I use the token file at opening the db? Bot how, I don't see an encryption flag for sqlite ...
Ok, 1 issue I solved: you can open up the sqlite db file directly, but you have to use sqlite3 :
Copy code
sqlite3 state.db <<< ".tables"
kine
s
Looking at a K3s cluster which is over 4 year old, my kine db is 190MB - so 21GB seems quite large. Do you have a lot of CRDs and data stored in them?
b
I did a
Copy code
kubectl get-all | wc -l 
2291
so there are 2000 objects (including CRDs) in the api server, it still doesn't explaimn it ...
s
Ah - I've found another node which was running hundreds of thousnads of jobs a day for a long time and it is a bit larger...
Copy code
-rw-r--r-- 1 root root 7.1G Nov 27 14:28 state.db
-rw-r--r-- 1 root root 170M Nov 27 14:28 state.db-shm
-rw-r--r-- 1 root root  86G Nov 27 14:28 state.db-wal
(I think the
.db-wal
should be rolled into the
.db
file at some time - but I don't know when sqlite3 will do that.) So, perhaps 21GB isn't that large when compared to closer to 100GB. I haven't investigated what resources are hanging around, that might be a fun exercise. I had loads of jobs which failed due to the far end resources going away, so I had to kill lots of stuck which may have resulted in finalisers hanging around 🤷