-
Notifications
You must be signed in to change notification settings - Fork 672
Weave-Net on Kubernetes should support externalTrafficPolicy: Local #2924
Comments
Thanks for the report @tomte76. At first glance |
This comment from the Kubernetes issue seems pertinent:
So the kube-proxy DNAT rule is all that is desired, and we would need some way to say that Weave Net should not do its masquerading in that case. |
I just faced the same issue guys, details here: kubernetes/kubernetes#51014 @bboreham what are your thoughts on a potential fix after three months? Just curious. |
Sorry, haven't thought about this much. The Weave Net masquerade rules are applied by this line which calls through to here and they are unconditional - everything coming in or out of the weave address range is masqueraded. Since The existence of ip-masq-agent suggests that people need something more than a blanket policy. Given it's still impossible to query for the Happy to consider a PR that does any or all of the above. |
Currently we're going to solve this with 2 things for our nginx-ingress nodePort service:
This won't add new iptables rules when weave allocates a new range (or update on any modifications on the local weave ranges) I hope this is of use for others. Feedback always welcome |
Thanks for the tips @mrdima! Since your shell script is a bit dense, could you summarise what it does? Or maybe give a before/after example to give the idea? |
@bboreham sure. The problem is in the nat table (iptables -L -n -t nat) WEAVE chain, this contains normally something like: What we want is RETURN rules before this 2nd line for each local weave IP range. So we insert rules for this on line 2 with "-I 2" using iptables So an example part of the weave report output (IPAM snippet only, there's more nodes in the entries normally ofcourse) might be: I'm using a systemd unit to start this script on each node, example output: So the iptables nat WEAVE chain now looks like: So the 2nd line is added. It works if the node has multiple weave IP ranges, but as said, this doesn't update it...could add a timer to the systemd unit, but you really want this event based within weave when it allocates a new range. |
Im surprised that this isnt bigger issue since we cant know users IP visiting our API via LoadBalancer. During our development, we found WeaveNet to be our favourite because of encryption and its stable but this is showstopper for us. We could use HostPort and manual LB setup but its not the right way. Looking forward to solution for this. This would make it 10 out of 10 perfect solution for us. |
P.S. mrdimas script works. i just had to modify regexes to
to make it more universal, since iptables in my shell returns a lot of whitespaces (not just one) Only thing i will have to test later is to see if this only does implement for services with "LOCAL" or for all services. |
By the way i think in script where you calculate cidr from size 32768 could be incorrect. Currently its shouldnt it be like |
Yes, you're totally right, I need to fix that, I'll update the gist and also the regexes after retesting (when I have a moment, hopefully tomorrow). Yet I now see something interesting in weave report on an environment, sizes like: 98304 and 196608. These do not fit into a normal netmask...that's annoying. |
Ok, more than a month later I updated my gist. It now uses the ip ranges instead of (sometimes impossible to match) cidr ranges equal to the ones weave has. (-m iprange --dst-range). |
@mrdima Have you considered removing |
Could we have a new stable release for this issue, e.g. v2.3.1? According to my understanding, roadmap issues for v2.3.1 are all merged (https://github.com/weaveworks/weave/milestone/72)? The support of Thank you for your kindly consideration. |
@hswong3i Unfortunately, this is not a bugfix, so we cannot include it in the minor v2.3.1 release. While waiting for v2.4.0 and if you want to test the feature, you can use the |
Released: https://github.com/weaveworks/weave/releases/tag/v2.4.0! To use the feature, you need to pass |
Upstream Changes: - weave 2.4.0 (https://github.com/weaveworks/weave/releases/tag/v2.4.0) - Support `externalTrafficPolicy: Local` (weaveworks/weave#2924) - Make the ipset list size bigger (weaveworks/weave#3305) - Break out of kube rm-peers loop if nothing changes (weaveworks/weave#3317) Our Changes: - Revamp weave-net.yml.j2 with upstream changes - Add more variables for customization - Replace WEAVE_PASSWORD with k8s secret - Remove hard-corded seed mode support, in favor of variables customization
Upstream Changes: - weave 2.4.0 (https://github.com/weaveworks/weave/releases/tag/v2.4.0) - Support `externalTrafficPolicy: Local` (weaveworks/weave#2924) - Make the ipset list size bigger (weaveworks/weave#3305) - Break out of kube rm-peers loop if nothing changes (weaveworks/weave#3317) Our Changes: - Revamp weave-net.yml.j2 with upstream changes - Add more variables for customization - Replace WEAVE_PASSWORD with k8s secret - Remove hard-corded seed mode support, in favor of variables customization
Hello,
I opened the issue #44963 on kubernetes/kubernetes, because the OnlyLocal annotation to preserve the external client IP seems not to work on (at least) Kubernetes 1.6.1 and 1.6.2.
kubernetes/kubernetes#44963
As we are using the weave-net addon @MrHohn from Kubernetes asked me to also file the issue here to maybe get some input. Is it sufficient to point to the kubernetes issue or should I copy the debug information and output here? Thank you.
The text was updated successfully, but these errors were encountered: