Skip to content
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

Networking improvements to support Docker Swarm / VXLAN #5062

Closed
wants to merge 2 commits into from

Conversation

rvleij
Copy link

@rvleij rvleij commented Jan 29, 2021

Why
In order to support the Docker Add-On in LE to run in a Docker Swarm setup, overlay networking (VXLAN) support is required, which was not part of the included kernel in 9.2.6. Docker Swarm allows the LE box to run in a cluster, automatically load balancing workloads (containers) over the LE box and (for example) a Pi4.

How
This PR includes the required kernel modules (VXLAN as well as netfilter (iptables) modules and IP_VS modules required for the built-in load balancing and iptables filtering and matching rules used with Docker Swarm. The required version bump of iptables and it's libraries is already included in the master branch (originally needed the same bump on 9.2.6).

Testing
To test I ran multiple test builds (on 9.2.6) and installed them on amd64, until I got this running without errors. Docker now starts without errors and provides the full cluster / overlay networking functionality out of the box. Testing and size comparisons are on 9.2.6, the image included the new Iptables and Libnft versions that are already part of master branch. Size increase is limited:

Size Increase numbers
New image:
256001312 Jan 26 22:30 LibreELEC-Generic.x86_64-9.2-devel-20210126212510-6bd7e98.img.gz
16655232 Jan 26 22:30 LibreELEC-Generic.x86_64-9.2-devel-20210126212510-6bd7e98.kernel
257443840 Jan 26 22:31 LibreELEC-Generic.x86_64-9.2-devel-20210126212510-6bd7e98.ova
242139136 Jan 26 22:30 LibreELEC-Generic.x86_64-9.2-devel-20210126212510-6bd7e98.system
259123200 Jan 26 22:30 LibreELEC-Generic.x86_64-9.2-devel-20210126212510-6bd7e98.tar

Original 9.2.6 image from website:
16577408 Oct 25 11:03 KERNEL (increase 77824 B)
255879664 Jan 29 21:18 LibreELEC-Generic.x86_64-9.2.6.img.gz (increase 121648 B)

I haven't made changes to the other projects/archs, since I can't test.
The individual components (iptables, netfilter libs and kernel modules) are running on other architectures (arm etc) normally.

@@ -1018,9 +1018,9 @@ CONFIG_NETFILTER_FAMILY_BRIDGE=y
# CONFIG_NETFILTER_NETLINK_QUEUE is not set
CONFIG_NETFILTER_NETLINK_LOG=m
# CONFIG_NETFILTER_NETLINK_OSF is not set
CONFIG_NF_CONNTRACK=m
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one was originally a Module, but later complained it needed to be compiled into the kernel, probably caused by some other compiled netfilter module.

# end of Core Netfilter Configuration

# CONFIG_IP_SET is not set
# CONFIG_IP_VS is not set
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list of added modules is needed for round robin virtual server loadbalancing in netfilter, used by Docker Swarm to load balance incoming connections over multiple worker nodes, on each of those nodes.

@@ -1866,7 +1871,7 @@ CONFIG_WIREGUARD=m
CONFIG_MACVLAN=m
# CONFIG_MACVTAP is not set
# CONFIG_IPVLAN is not set
# CONFIG_VXLAN is not set
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is how it started, enabling VXLAN overlay networking support in the kernel.

@rvleij
Copy link
Author

rvleij commented Jan 29, 2021

Oh, and the original feature request I made:
https://forum.libreelec.tv/thread/23377-vxlan-support-in-kernel/

@CvH
Copy link
Member

CvH commented Jan 30, 2021

Not saying we should not, but vlanx is really enterprise tech, so basically no common router/switch or for example pfsense supports it.

@rvleij
Copy link
Author

rvleij commented Jan 30, 2021

Not saying we should not, but vlanx is really enterprise tech, so basically no common router/switch or for example pfsense supports it.

Thats' correct, it's not something you'd run at home normally speaking and also not to create a network "manual" this way. It's purely needed for Docker Swarm. And I guess, the majority of users are not even running Docker containers and if they do it's doubtful they'd run a cluster between the docker servers at home. I realise I'm "special" haha.

Maybe look at the usage numbers of the Docker plugin to get a feel for how many people could potentially benefit? VXLAN is part of the default kernel config I think, since the only references I found were special distributions and hosters that prevented people from running things like Swarm or Kubernetes.

Anyway, like I wrote in the feature request: I do realise I didn't contribute something for the masses :) I just wanted to hare my work back and it's up to you guys if it's useful for other users.

@rvleij
Copy link
Author

rvleij commented Jan 30, 2021

Just as an info, I also compiled this on the master branch with the following image and kernel sizes as a result. My estimation is that kernel size increase is similar to the 9.2.6 build I made earlier, the image size increase is the same as well. Compared to 9.2.6 I didn't have to bump iptables and libnft, they were already included...

260131368 Jan 30 11:05 LibreELEC-Generic.x86_64-9.80-devel-20210130110233-d7a5aa0.img.gz
20956704 Jan 30 11:04 LibreELEC-Generic.x86_64-9.80-devel-20210130110233-d7a5aa0.kernel
261744640 Jan 30 11:05 LibreELEC-Generic.x86_64-9.80-devel-20210130110233-d7a5aa0.ova
239177728 Jan 30 11:05 LibreELEC-Generic.x86_64-9.80-devel-20210130110233-d7a5aa0.system
260474880 Jan 30 11:05 LibreELEC-Generic.x86_64-9.80-devel-20210130110233-d7a5aa0.tar

@heitbaum heitbaum added LE 11.0 and removed LE 10.0 labels Feb 14, 2021
@CvH
Copy link
Member

CvH commented Dec 25, 2021

@rvleij I am closing this because its not really something that fits into LE by default

Nevertheless, tx for the pr !

@mossroy
Copy link

mossroy commented Jan 15, 2022

@rvleij : for information, I've managed to make k3s (lightweight Kubernetes) run on LibreElec, even if it's still using dirty hacks. See k3s-io/k3s#4859
Like in this PR, I had to add a few kernel options and recompile it.
My PR #6100 has been refused for the same reasons as this one (which I understand), but if you're interested let me know

@rvleij
Copy link
Author

rvleij commented Jan 16, 2022

@mossroy Hi, thanks for the pointer! I've actually built a new "home server"and I'm running vanilla Ubuntu now, with Swarm still. I was looking at k3s (or whatever Ubuntu has as light-weight K8S) but decided to leave things as they are right now. :)

Thanks for the heads up though! Maybe one day I'll add a LibreElec to the game again and use it just as an extra node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants