Is your feature request related to a problem? Please describe.
Automating a k3s ha setup is a bit difficult because if you start k3s using the cluster-init parameter the server will run forever. It would be better to do a brief startup and exit the system once some self check is sucessful. A subsequent start of the first server should just be without the parameter. If provided it should just exit with an error like cluster already initialized. The --server parameter should also be similar it should be use only for the first startup. It should just do a inital sync and exit.
Right now my Vagrant provision scripts looks like this:
# first server
K3S_TOKEN=SECRET timeout 60s k3s server --cluster-init --flannel-iface=eth1
K3S_TOKEN=SECRET k3s server --flannel-iface=eth1 &
# other servers
K3S_TOKEN=SECRET timeout 120s k3s server --server https://192.168.10.51:6443 --flannel-iface=eth1
K3S_TOKEN=SECRET k3s server --flannel-iface=eth1 &
In a perfect world after cluster init all systemd service files should be the same. Furthermore I should be able to reboot one server at a time without a cluster breakdown. Stopping all servers and starting them one by one after a power outage should also be possible.
Same option would be nice for the default manifests. Like, it'd be nice to run an initial init to create the default manifests and everything else, and then the actual run-forever server wouldn't have to worry about overwriting things. Right now the server code handles both initial setup and permanent execution, happily overwriting everything even if the system has already been configured.
Most helpful comment
Same option would be nice for the default manifests. Like, it'd be nice to run an initial init to create the default manifests and everything else, and then the actual run-forever server wouldn't have to worry about overwriting things. Right now the server code handles both initial setup and permanent execution, happily overwriting everything even if the system has already been configured.