-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offline install or run with no gateway set - k3s service won't run #1103
Comments
Sorry, it used to be documented that a default route is needed for air-gap. The docs were something like this: If networking is completely disabled k3s may not be able to start (ie ethernet unplugged or wifi disconnected), in which case it may be necessary to add a default route. For example: sudo ip -c address add 192.168.123.123/24 dev eno1
sudo ip route add default via 192.168.123.1 We should investigate what flags are needed to work without a default route, add better docs, and maybe check for a default route in check-config. |
Thank you for looking at this. I have already scripted checking for a default route when installing. For example: if [ -z "$(ip route | grep default)" ]; then
echo "default route missing"
exit 1
fi Docs are nice. What would help the most is being able to install without a default route. I have looked at the code and could not see anything 'easy'. The main problem is "how to determine the IP of the node" - especially on a host with more than one NIC. The simple answer is "it's the one with the default route" - so I can see why it's currently like that. |
I have found a workaround which allows a true air-gap installation:
Add Alternatively just add I traced the problem to flannel wanting to know what IP to bind to, to do that it looks for which interface has the default route and obtains its IP address. By specifying the interface it does not need a default route. By specifying a tap interface you don't even need an ethernet interface up with an IP. It would be better if it did some of this itself and didn't rely on there being a default route. So I don't think this is only a documentation defect/feature request. |
interested in this too. my use case is that i keep my RPi k3s cluster off any network (in a camper) periodically and then bring it back home and put it back on my home network. k3s works great when connected to my home network, but when it has no connection to a network (and therefore no default gateway), the k3s service fails to start. |
This would really be a nice benefit if k3s could more reliably start in different network conditions. Testing @danielbarron42's suggestion - but this becomes a real foot-gun with k3s currently! One note that I haven't 100% confirmed yet - starting the cluster with |
I have k3s working reliably air-gapped and without a gateway for years using my above workaround. Recently I found a couple of other things I do are required as well. This is what I do: --flannel-iface tap0 (see how to make the tap0 interface in my workaround above) I make sure the coredns configmap doesn't have a forward if there's no DNS configured, which I would expect there not to be when air-gapped. Or coredns won't start. I also set: |
Version:
k3s version v0.9.1 (755bd1c)
/usr/local/bin/k3s server --write-kubeconfig-mode 664 --no-deploy traefik --docker --cluster-cidr 10.244.0.0/16
Describe the bug
I am using k3s in air gap/offline environments. I can install and run successfully without any internet access, but only if a gateway address is set. To be truly offline/air gap, I would like to be able to run and install without a gateway set. If I don't, for example during install I get:
There are circumstances where the gateway may become unset after installation as well which takes out some of the pods and causes remote (via local LAN in the same subnet via a service in the affected pods) access to be unavailable.
I believe this is caused by the code which tries to determine what IP to use for the node.
I have tried specifying --advertise-address as the IP of the node as well as trying 127.0.0.1. I tried the same with --bind-address.
To Reproduce
Attempt air gap install with no network gateway set.
Expected behavior
Install to succeed and all normal functionality to work. And post install, if the gateway is removed, all normal functionality to continue.
Actual behavior
Install fails. Service errors as listed above.
The text was updated successfully, but these errors were encountered: