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

Document required iptables rules when using Antrea Proxy #1133

Closed
antoninbas opened this issue Aug 21, 2020 · 5 comments · Fixed by #1425
Closed

Document required iptables rules when using Antrea Proxy #1133

antoninbas opened this issue Aug 21, 2020 · 5 comments · Fixed by #1425
Assignees
Labels
kind/documentation Categorizes issue or PR as related to a documentation. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@antoninbas
Copy link
Contributor

When using Antrea Proxy, one would expect kube-proxy / iptables performance not to impact Pod-to-Service traffic performance, since this traffic is handled in OVS. However, in practice performance deteriorates as the number of Services increase. This is because encapsulated traffic needlessly visits the kube-proxy iptables rules, incurring high CPU usage. The UDP tunnels are also added needlessly to the connection tracking table.

To avoid this issue, @tnqn @wenyingd and @edwardbadboy suggest installing the following iptables rules:

iptables -t raw -I PREROUTING -p udp --dport 6081 -m addrtype --dst-type LOCAL -j NOTRACK
iptables -t raw -I OUTPUT -p udp --dport 6081 -m addrtype --src-type LOCAL -j NOTRACK

These rules added to the raw table will ensure that all Geneve traffic bypasses connection tracking and kube-proxy iptables rules. The specific rules will differ based on the encapsulation mode being used.

At the very least, this should be documented. We should also investigate whether these rules can be installed by Antrea programmatically to simplify usage, or if there is any potential adverse effect.

Credits go to @tnqn @wenyingd and @edwardbadboy for troubleshooting this issue.

@antoninbas antoninbas added the kind/documentation Categorizes issue or PR as related to a documentation. label Aug 21, 2020
@antoninbas antoninbas added this to the Antrea v0.10.0 release milestone Aug 21, 2020
@antoninbas
Copy link
Contributor Author

@tnqn @wenyingd it is unclear to me whether there is anything that can be done for noEncap mode, without risking to affect routing?

@antoninbas antoninbas added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Aug 21, 2020
@antoninbas
Copy link
Contributor Author

@tnqn @wenyingd is there a plan to push any change (documentation or other) for 0.10? or should we push this to the next milestone?

@wenyingd
Copy link
Contributor

@tnqn @wenyingd is there a plan to push any change (documentation or other) for 0.10? or should we push this to the next milestone?

I think the fix should be included in next release.

@tnqn
Copy link
Member

tnqn commented Sep 24, 2020

Agree this could be in next release, this should only matter when there are many iptables rules and many short-live connections. A proper change may need to limit the destination IPs to Node IPs of the cluster only, otherwise UDP connections to another endpoint that happens to use geneve/vxlan UDP port may be affected if conntrack is desired.

@tnqn
Copy link
Member

tnqn commented Oct 21, 2020

@tnqn @wenyingd it is unclear to me whether there is anything that can be done for noEncap mode, without risking to affect routing?

I thought about this, but haven't come up with an approach that could bypass conntrack only for Pod-to-Pod traffic going throught host network. It's because PREROUTING chain is the only chance we can add "NOTRACK" for routed packets, but we cannot identify Pod-to-Pod packets from real Pod-to-Pod packets and the response of Pod-to-Service packets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/documentation Categorizes issue or PR as related to a documentation. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants