Problem
My main SSD is to 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.
Caution!
Before you do any of the following, make sure to stop the cluster with:
sudo systemctl stop k3s
Solution
K3s supports having acustom 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 …
Problem
My main SSD is to 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.
Caution!
Before you do any of the following, make sure to stop the cluster with:
sudo systemctl stop k3s
Solution
K3s supports having acustom 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
root: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](mailto:feedback@janusworx.com?subject=%22Feedback on post: K3s: Move Data Folder %22) 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!