Skip to content

Conversation

@Till0196
Copy link
Contributor

@Till0196 Till0196 commented Aug 22, 2025

Removes iptables mangle rules that were added to fix UDP checksum issues caused by kube-proxy's double NAT.

  • Removed IPv4/IPv6 iptables mangle rules with --checksum-fill for UDP packets
  • Cleaned up unnecessary iptables client initialization

Background

While the egress functionality can be directly replaced from iptables to nftables, nftables doesn't have an equivalent rule for the iptables CHECKSUM target, which complicates the implementation. I'm planning to add nftables support for the egress implementation, but this workaround was blocking that effort.

Upon reviewing the code, I found that the use of the CHECKSUM target was intended as a temporary workaround, raising questions about whether it's still necessary. Therefore, I decided to remove the relevant code and conduct verification tests.

@ymmt2005
Copy link
Member

I'm not too sure if this is really unnecessary.
Please add an explanation about why you believe so.

@Till0196
Copy link
Contributor Author

Thank you for your comment @ymmt2005
(I added background to the description.)

I tested it without the checksum workaround and it works well.
I deployed NAT pod that was removed the checksum workaround and a client that sends a message to servers via a NAT.

I confirmed that the server recieved a message from the client and the message's src IP is Egress's IP.

The details are below.

Test Environment

The validation was performed under the following environment

  • kind (Kubernetes in Docker)
  • Calico in policy-only mode
  • kube-proxy
  • use Coil built-in CNI

Verification Steps

# Check egress pods status
% kubectl get pods -n internet -l app.kubernetes.io/instance=egress-sport-auto -o wide
NAME                                 READY   STATUS    RESTARTS   AGE     IP           NODE                   NOMINATED NODE   READINESS GATES
egress-sport-auto-6448576774-ps8mw   1/1     Running   0          3m46s   10.244.0.6   coil-2-control-plane   <none>           <none>
egress-sport-auto-6448576774-s5ldh   1/1     Running   0          3m48s   10.244.0.5   coil-2-control-plane   <none>           <none>

# Set up dummy interface on control plane node
% docker exec coil-2-control-plane bash -c '
ip link add dummy-fake type dummy && \
ip link set dummy-fake up && \
ip address add 9.9.9.9/32 dev dummy-fake'

# Deploy echotest utility
% docker cp echotest coil-2-control-plane:/usr/local/bin
Successfully copied 7.57MB to coil-2-control-plane:/usr/local/bin

# Start echo server
% docker exec coil-2-control-plane /usr/local/bin/echotest --reply-remote

# Test FoU tunnel connectivity
% kubectl exec nat-client-sport-auto -- curl -s http://9.9.9.9
10.244.0.5|% 

@ymmt2005
Copy link
Member

@Till0196
Thank you for the background. Understood, please go ahead.

Copy link
Contributor

@chez-shanpu chez-shanpu left a comment

Choose a reason for hiding this comment

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

LGTM

@chez-shanpu chez-shanpu merged commit 675cbcb into cybozu-go:main Aug 25, 2025
55 of 58 checks passed
@Till0196 Till0196 deleted the remove-kube-proxy-nat-workaround branch August 26, 2025 00:22
@Till0196 Till0196 restored the remove-kube-proxy-nat-workaround branch August 26, 2025 00:25
@Till0196 Till0196 deleted the remove-kube-proxy-nat-workaround branch August 26, 2025 00:25
@Till0196 Till0196 restored the remove-kube-proxy-nat-workaround branch August 26, 2025 00:29
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.

3 participants