-
Notifications
You must be signed in to change notification settings - Fork 473
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
nftables with conntrack can break kube-router #1777
Comments
That's good to know. I'm not totally sure that there's anything that the kube-router project can do about it. From what I can tell, its likely an upstream netfilter incompatibility. Essentially kube-router uses the old iptables legacy binaries from the netfilter project to generate nft rules. We've never done the conversion to using nft natively because:
In the past, the user-space tooling from the netfilter project has been pretty stable, but recently (in the last year and a half or so) it has become a lot less stable for some reason. We've found API incompatibility between bug fix releases of the tooling several times over the last few releases, and a current break in functionality has kept kube-router pinned on an older version of Alpine the last 2 or 3 minor releases. To be fair, I think that the upstream project has struggled to keep pace with the container ecosystem. Having a containerized version of the user-space tooling writing one set of rules to the kernel structures and having an OS host version of the user-space tooling writing to the same set of kernel structures is probably a use-case that they didn't architect for when starting out with netfilter. It looks like this time, they've broken compatibility between the legacy binary and the rules that the nft binary writes. If this is a blocker for your workflow, or something that you want to save other people from stumbling across, I'd recommend reporting it upstream. If they fix it, then let us know what version it is fixed in and we'll try to upgrade our iptables userspace tooling in the container image. |
Thank you @aauren for this very in-depth response.
I totally understand. I mostly wanted to report a new way a breakage could happen and was curious on the nft roadmap (great insights too). Feel free to close this issue. I can always re-open if this gets fixed upstream. |
It looks like iptables-1.8.11 fixes the issue with checking iptables rules that was introduced in iptables-1.8.10 and kept us on a legacy iptables userspace in the kube-router container (1.8.9). My hope is that once Alpine releases a version that includes the iptables-1.8.11 userspace that we can use that and it should hopefully make it more resilient to host userspace tooling versions, since it should hopefully be more compatible with newer userspace version. While we wait for Alpine to release, I've built my own iptables 1.8.11 packages for Alpine and included them in a PR build here: #1790 If the machine that you're testing doesn't have access to sensitive data, and you're willing to trust custom iptables binaries made by the project, and your cluster is using AMD64 architecture machines, you can give |
What happened?
When a certain conntrack rule is added via the nft command, it breaks the netpol controller when it tries to setup the firewall with k3s.
I created k3s-io/k3s#11415 but they indicated the error was coming from this library.
Thank you for your help
The logs indicate the following:
What did you expect to happen?
The following code was expected to return instead of failing
kube-router/pkg/controllers/netpol/network_policy_controller.go
Lines 410 to 413 in 65a8030
How can we reproduce the behavior you experienced?
When using
The command generated by the library will fail with
Whereas if the rule has been added with:
The command correctly returns and can be parsed
The problem might be with iptables-nft but just wanted to raise it here since this library parses the output.
Screenshots / Architecture Diagrams / Network Topologies
Just a single node
System Information (please complete the following information)
kube-router --version
): v2.2.1kubectl version
) : v1.30.6This is running on Ubuntu 24.04
Logs, other output, metrics
NA
Additional context
NA
The text was updated successfully, but these errors were encountered: