Can Kubernetes of Kubeadm work offline with Calico?

12/5/2019

I installed a local Kubernetes stack by Kubeadm on an Ubuntu 18.04 box. Its network status could be be in: 1. offline, 2. internet connected via WiFi nic, 3, internet connected via Wired nic, and I cannot control when the status would be switched over between each other physically by users in stores.

I need to find a way to keep local Kubernetes API server up and running. Also it's "costly" to delete local Kubernetes stack and re-run "kubeadm init" just for switching nics when unattended in stores.

So I created a dummy nic with a dedicated IP for “kubeadm init --apiserver-advertise-address=172.16.78.89 ...“, which seems to be the only choice. (CNI is Calico)

nmcli con add type dummy con-name kubenic ifname kubenic ipv4.addresses 172.16.78.89/24 ipv4.method manual
nmcli con modify kubenic ipv4.gateway 172.16.78.89

Suppose physical nics are back online connected, data won't go through the dummy nic with two routes coexist like below, because route metric of physical nics are much lower than that of the dummy nic.

default via 192.168.176.1 dev eno1 proto dhcp metric 100 (physical nic)
default via 172.16.78.89 dev kubenic proto static metric 20550 (dummy nic)

If the minimum exception of "working offline" is just to keep local Kubernetes stack not dead, i.e. to survive and endure some "offline time slots", then get back to real business when physical nics are connected. Would this practice sound like a good workaround? And by any chance these configuration will lead to Ubuntu system reboot?

Furthermore, can Kubernetes of Kubeadm be "working offline" totally?

Thanks!

-- ocean
calico
kubeadm
kubernetes
offline

0 Answers