k3sup icon indicating copy to clipboard operation
k3sup copied to clipboard

Add --data-dir as a flag instead of passing it via --k3s-extra-args

Open alexellis opened this issue 2 years ago • 2 comments

Expected Behaviour

It would be convenient to have a flag for --data-dir in the k3sup install and join commands.

Current Behaviour

A longer flag is required:

--k3s-extra-args="--data-dir=/mnt/ssd/k3s"

Possible Solution

You don't need an SSD to test this, the command just installs k3s into a custom path for its data.

Make --data-dir output additional arguments to k3s-extra-args, as per other flags we already have that work this way.

Bear in mind that there is a setupAdditionalServer and setupAgent function, both of which work in a very similar way.

Context

Thought of this whilst looking into #373

There also appears to be a bug in the join command which means extra args are ignored due to the ordering of string concatenation?

Screenshot from 2022-08-26 11-38-26

Related to: https://github.com/alexellis/k3sup/pull/388

alexellis avatar Aug 26 '22 10:08 alexellis

I'll take this one if you don't mind. :)

Jasstkn avatar Sep 03 '22 09:09 Jasstkn

This is still an issue. I am documenting on this open ticket to say that join commands will fail if you change the folder location to something custom using --data-dir=... the script will attempt to get the token from /var/lib/rancher/k3s/token even if you defined it in a different place. The quickest solution is to symlink from your data-dir to the default folder ln -s /custom/data-dir/k3s /var/lib/rancher/k3s The other solution is to make the script discover if that value is present and have it look there for the token.

voodoologic avatar Dec 27 '23 20:12 voodoologic