Problem
My main SSD is too small to hold all my kubernetes and K3s shenanigans. (It’s only about 512gb) So I need a way to move my K3s data folder out to my big HDD.
Solution
Caution
Before you do any of the following, make sure to stop the cluster with:sudo systemctl stop k3s
K3s supports having a custom data directory, by letting me specify a data-dir.
I decided to specify it in the K3s config file at /etc/rancher/k3s/config.
If it isn’t there (as it wasn’t in my case), just create one. You’ll need to do this as the root user.
This is what I now have in there.
data-dir: /BIGHDD/rancher/k3s
And then, I …
- Created a
rancherdirectory in my big hard disk. (rootowns it) - Ran rsync as the
rootuser:rsync -a /var/lib/rancher/k3s/ /BIGHDD/rancher/k3s/ - Started up my cluster again with a
sudo systemctl start k3s
Feedback on this post?
Mail me at feedback at this domain or continue the discourse here.
P.S. Subscribe to my mailing list!
Forward these posts and letters to your friends and get them to subscribe!