This message was deleted.
# k3s
a
This message was deleted.
a
I can't see anything in the documentation about this. If I can force it down VLAN 4000, then I can reconfigure UFW to prevent internet access to any important ports
g
You can set
node-ip
in the config
a
oh great thanks. I missed that one. Will that all configure the etcd instance to use the same IP?
g
Yep it should! You can also set
advertise-address
to be double certain for those too
a
Great. thanks Max
👍 1
This is probably a dumb question, but if I used this command to install k3s: curl -sfL https://get.k3s.io | K3S_TOKEN=MY_KEY sh -s - server --cluster-init --docker What command do I use to update it? I thought it would be this: K3S_TOKEN=MY_KEY sh -s - server --docker -i 192.168.100.1
But this, just puts me to a '#' prompt
g
Sorry if I overexplain… 1.
curl -sfL <https://get.k3s.io>
--> retrieves the contents from that URL 2.
| …
pipes the output, meaning it takes the output from the curl command and uses it as input for the next stuff. All the next stuff together is starting k3s: 3.
K3S_TOKEN=MY_KEY
is setting the environment variable, which the install script reads 4.
sh -s -
Running the install script, which will run a series of shell functions 5.
server --cluster-init --docker
Arguments to pass to the
k3s
process that the install script is aware of what to do with them. You’ll see these actually get added to the systemd service file at
/etc/systemd/system/k3s.service
SO the best way, if you want to restart, would probably be to uninstall and reinstall using the same process: 1.
sudo k3s-uninstall.sh
2.
curl -sfL <https://get.k3s.io> | K3S_TOKEN=MY_KEY sh -s - server --cluster-init --docker --node-ip=192.168.100.1
You can also just rerun this directly without uninstalling, but results may be unexpected because kubernetes doesn’t behave well when a node ip is changed
a
Thanks. Always better to over explain 🙂 I don't want to re-install, I have setup quite a bit of config and quite a lot of containers. Based on the above, should I just run the following then? K3S_TOKEN=MY_TOKEN k3s server --docker -i 192.168.100.1
g
Take a look at https://github.com/k3s-io/k3s/discussions/7326 and https://github.com/k3s-io/k3s/issues/6524#issuecomment-1321130017.. I think the second one will probably be the most helpful in this case. Changing node ips is weird, so you might have to jump through a few hoops in this case
a
ok, will do. thanks. I've already stopped the services, updated the firewalls, and now adding the -i param, so I am hoping it works. But I'll double check those
That does look a bit nasty... if it fails, will will uninstall and reinstall. at least everything I have deployed is documented so I can recreate in a few hours at worst
g
Yep and I would add, take a snapshot first in case you wanna say screw it and just keep your current stuff!
Should be as easy as
sudo k3s etcd-snapshot save
a
ok. good idea. i'll do that. so i presume the killall process doesn't delete that?
g
Correct! It just stops the running service and pods and stuff
1
Doesn’t remove any data
a
and is that only required on the primary
g
killall is required on all, take the snapshot on each node as it will save it locally (unless you want to specify an s3 or minio storage endpoint): https://docs.k3s.io/cli/etcd-snapshot
a
ok got it
thanks again Max, much appreciated
👍 1
the docs could really do with info on reconfiguring, esp as the CLI install with params doesn't get persisted to the /etc/rancher/k3s/config.yaml mentioned in the docs. If it did you could just stop the service, edit and restart
g
Feel free to open an issue at https://github.com/k3s-io/docs or on the main repo
a
I'll do that tomorrow. Thanks
some of those links are out of date I think for the changing of the ip. there is no k3s-agent.service.env for full server nodes, only a k3s.service.env and that only contains the key. I'm struggling to find where the config might be stored for the k3s.service
g
It’s just
k3s.service
.
k3s-agent.service
is for agent (or worker) -only nodes.
Config would be in
/etc/rancher/k3s/config.yaml
if you had set that up, but otherwise is just directly in the service file at the part where it’s starting the k3s service.. You’ll see something like
k3s server --arg1 --arg2 …
a
no, there is no file called that because it was jus setup on the CLI. Yes, just found it in the service. Will try editing the IP in there:
though it must have a record of the other nodes, though probably etcd
g
You can create the config.yaml also and just put it there! It makes managing configuration much easier when it’s in its own file, and we’ve been recommending it
yeah etcd is going to be managing that
a
ah ok.. so if i put a new one there now, it will add whatever settings in
g
upon restart yep!
a
i'll install the etcd cli and take a look.. service is upset. I'll learn more that way
👍 1
g
yeah this is getting you into the weeds of configuring, updating, and restoring a kubernetes cluster, which isn’t really ever easy, even though k3s tries its best to simplify it as much as possible 😓
a
service won't start now.. so i'll have to. unfortunately made the UFW changes prior to taking a snapshot, so I can't get in to take one. from systemctl status it is upset it can't get to the other nodes so throws an error 500
g
ah yeah ufw changes would have to happen as the last step
a
you live and learn
💯 1