https://rancher.com/ logo
Title
a

ancient-raincoat-46356

10/17/2022, 9:07 PM
I created a bash script today to start taking backups of my K3s cluster. Currently I'm only grabbing the following
COPY_CONTENTS=( "/var/lib/rancher/k3s/server/db/snapshots" "/etc/rancher/k3s/k3s.yaml" "/etc/default/k3s" )
The docs really only say to backup the ETCD snapshots but I'm finding a few other things that seem important. Does anyone have any other suggestions of things I should be including?
c

creamy-pencil-82913

10/17/2022, 9:17 PM
/etc/rancher/k3s/k3s.yaml
This file is generated on startup, there’s no point in backing it up
You should also back up
/var/lib/rancher/k3s/server/token
as you need the token if you ever want to restore from backup
a

ancient-raincoat-46356

10/17/2022, 9:21 PM
Ah yes. I mixed those two up. I knew there was something else I needed along with the snapshots... The token.
How come the docs don't mention some of the other possible files? I'm including one because my master nodes need an env var to route through a proxy, but when I researched to figure that out, there were 3 different places I could have put those. The Backup/Restore documentation mentions none of that.
c

creamy-pencil-82913

10/17/2022, 9:26 PM
Its assumed that if you configure k3s, you know what/where you configured and would also restore that.
If you’re managing the configuration of your nodes, all you should need to back up are things generated by k3s itself. Everything else should be handled by your configuration management system.
a

ancient-raincoat-46356

10/17/2022, 9:42 PM
Point well made. Thank you!