-
Notifications
You must be signed in to change notification settings - Fork 116
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
Routing of Flannel traffic over wireguard #139
Comments
Yes, noticed that too. I think what is happening is that wireguard is created, then kubeadm is configured to use wireguard IPs, and then when flannel starts, it discovers interface on its own, and choose eth. I had to deploy my cluster with kubeadm (additional worker failing), and I used that config for flannel on top of wireguard: Hope it helps! |
I've tried removing everything flannel related and used your file with kubectl apply and with kubectl create in both cases the result is that the pods are in crash loop. From the logs I can see that the post startup command errors out with a "Address already in use" message |
Yeah, maybe you have to clean some folders too, and iterfaces. I've used this command when I used kubeadm, to reset node:
And reboot the node, it might help, but be careful, I'm not sure the node will join again the cluster. Try this at your own risk, on staging cluster. |
Your approach is generating new keys Everytime the network is restarting. That would lead to other nodes to lack the new public key. Isn't there a way just to specify which network interface should use? |
@pierreozoux's solution looks quite similar to flannel's official wireguard extension: In the docs, it says about the
See: https://github.com/coreos/flannel/blob/master/Documentation/extension.md |
@simonkern yes sorry, I should have linked to official doc instead of my folder :) |
There is an option |
I tried |
yes that's right, I experienced this behavior too |
Looks like I found a work-around
Just a PoC to test, we'll need to make checksum offload permanent in case of implementation of this solution |
I like your approach. Could you explain what's happening here? About the permanent solution, is systemd a good way to do that? That's what I would do here if this solution is sustainable. |
As @monofone mentioned, there is enough to specify I got near 1500Mbit iperf3 w/o wireguard and near 900Mbit with wireguard in my performance tests on cx11 instances. IMHO flannel tcp checksum offload doesn't affect speed noticeably, especially compared to wireguard encryption.
I was thinking about some
It did the job for me |
Does this persist after doing reboots, because of the "oneshot" type? |
It runs on every |
Then I think that is great material for a PR, WDYT? |
Hey guys, just read through the issue here. Do I understand correctly, that the traffic between the nodes is not encrypted, opposed to #128 ? Maybe we should declare this explicit in the repos README, as long as we got this covered. Might be a deal breaker for some evaluators. best |
did you try hostgw instead of vxlan over wireguard? |
I have the same question, currently the traffic inter nodes is not encrypted? So example if my webapp queries my mysql backend on a second node, the data can be sniffed? |
It didn't work because it creates a route pointing CIDR of the PODs to Wireguard IPs as a gateway, but Wireguard needs CIDR in AllowedIPs. |
Yes and you can configure the CIDR on the allowed IPs on each WG node, I have it working since year ago :) |
Forget, It work even with this log :D |
It is nice that there is wireguard, but it is not used for inter pod communication
Flannel by default uses the device with the default route (if run on the host), I'm not sure how it is handled when run as a pod
At least I could verify that my communication between two pods on two nodes is not encrypted, because it does not use the wg0 interface.
What I did:
I created a cluster
hetzner-kube cluster create ..... --ha-enabled -w 3
I launched 3 nginx containers (each container is scheduled on one node)
kubectl run nginx1 --image=nginx --replicas=3 --port=80
I started on each node (directly)
tcpdump -nnvvSSs 1514 -i eth0 | grep GET
I ran a single interactive container with curl:
kubectl run curl1 --image=radial/busyboxplus:curl -i -t --rm
In this container I startet
curl http://10.244...../MYTEST1 >/dev/null
For every connection between the busy box and a container on another node I gut a nice
GET /MYTEST1 HTTP/1.1 output from tcpdump
Therefore the traffic is no going flannel->wg0->encryption->eth0->and on but is going directly flannel->eth0, which means the traffic is not encrypted.
I also got some other GET / for instance when kubectl connected a terminal to a pod, so it appears that also not all control plane traffic is encrypted, except etcd, which seems to really use wg0
The text was updated successfully, but these errors were encountered: