OSMC has always been my choice of OS for my Raspberry Pi at home. Besides the media center, I’ve used it as automation playground for learning ansible, docker, etc. My current/latest setup consists with a few services running as containers, such as netdata and pi-hole.
With the release of k3s, which is described as a lightweight kubernetes - perfect for a Raspberry Pi - I decided to start migrating my stack to it. The thing is, k3s use flannel as its default CNI and the VXLAN kernel module has to be enabled in order to work.
$ k3s server INFO Preparing data dir /var/lib/rancher/k3s/data/... INFO[2019-03-09T17:59:28.921467845Z] Starting k3s v0.2.0 (2771ae1) INFO[2019-03-09T18:00:49.818476253Z] Running kube-apiserver ... ... INFO[2019-03-09T18:03:04.531762270Z] waiting for node bunker: nodes "bunker" not found INFO[2019-03-09T18:03:06.910030427Z] waiting for node bunker CIDR not assigned yet FATA[2019-03-09T18:03:14.009936424Z] flannel exited: operation not supported
I came to learn that the OSMC kernel does not include VXLAN by default, so modprobe won’t work. The options then are: disable flannel (with
—-no-flannel option in k3s), use another CNI (that don’t need VXLAN) or include the module in the source and recompile the kernel.
Recompiling it takes some time but it’s simple enough, you can see some instructions here.
The change needed, for Raspberry Pi 2:
diff --git a/package/kernel-osmc/patches/rbp2-000-add-kernel-config.patch b/package/kernel-osmc/patches/rbp2-000-add-kernel-config.patch index 595de2d55ffc..a2bedb4ff9ec 100644 --- a/package/kernel-osmc/patches/rbp2-000-add-kernel-config.patch +++ b/package/kernel-osmc/patches/rbp2-000-add-kernel-config.patch @@ -1636,7 +1636,7 @@ +# CONFIG_NET_TEAM is not set +CONFIG_MACVLAN=m +# CONFIG_MACVTAP is not set -+# CONFIG_VXLAN is not set ++CONFIG_VXLAN=m +# CONFIG_GENEVE is not set +# CONFIG_GTP is not set +# CONFIG_MACSEC is not set
With that, you should be good to go:
$ sudo k3s server & $ k3s kubectl get nodes NAME STATUS ROLES AGE VERSION bunker Ready <none> 2d18h v1.13.4-k3s.1 $ k3s kubectl cluster-info Kubernetes master is running at https://localhost:6443 CoreDNS is running at https://localhost:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
I also opened a pull request for it.
Here are some other great resources on getting rpis clusterified with kubernetes: