-
Notifications
You must be signed in to change notification settings - Fork 40.4k
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
kube-proxy currently incompatible with iptables >= 1.8
#71305
Comments
/sig network |
@kubernetes/sig-network-bugs |
@drags: Reiterating the mentions to trigger a notification: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
For the record, this probably breaks at least Calico and Weave as well, based on my abject failures to get pod<>pod networking to function on Debian Buster (which has upgraded to iptables 1.8). I'm filing bugs for that now, but this breaking change to iptables may be worth a wider broadcast to the k8s community. |
Tested versions; iptables v1.8.2, linux 4.19.3 The problem seems to be that that The kernel/user-space dependency is one of the problem that |
Iptables v1.8.2 have 2 modes (depending on soft-links);
and;
BTW; I have not tested any network policies, that is not |
While the title is somewhat murky the fact is that To be clear: this isn't a defect in the code, it's a defect in packaging/release. |
Do you mean it breaks on a newer kernel? The iptables binary is part of kube-proxy so what would the on-host iptables have to do with anything? I don't understand. |
There are 2 sets of modules for packet filtering in the kernel: ip_tables, and nf_tables. Until recently, you controlled the ip_tables ruleset with the In iptables 1.8, the maintainers have "deprecated" the classic ip_tables: the The problem arises when you mix and match invocations of iptables 1.6 (the previous stable) and 1.8 on the same machine, because although they look identical, they're programming different kernel subsystems. The problem is that at least Docker does some stuff with Empirically, this causes weird and wonderful things to happen - things like if you trace a packet coming from a pod, you see it flowing through both ip_tables and nf_tables, but even if both accept the packet, it then vanishes entirely and never gets forwarded (this is the failure mode I reported to Calico and Weave - bug links upthread - after trying to run k8s on debian testing, which now has iptables 1.8 on the host). Bottom line, the networking containers on a machine have to be using the same minor version of the |
@danderson Do you think it would be sufficient to enforce (if possible) the host version of iptables to "legacy";
and keep the >=1.8 version? I build and install
I assume the same applies for "Debian Testing/Buster" and others, but I don't knoe for sure. |
@danderson thanks. That was very succinct. What a crappy situation. How are we to know what is on the host? Can we include BOTH binaries in our images and probe the machine to see if either has been used previously (e.g. lsmod or something in /sys) ? |
As a preface, one thing to note: iptables 1.8 ships two binaries, Here's some requirements I think an ideal solution would have:
So far I've only thought up crappy options for dealing with this. I'll throw them out in the hopes that it leads to better ideas.
Of all of these, I think "probe with both binaries and try to conform to whatever is already there" is the most tractable if kube-proxy were the only problem pod... But given the ecosystem of CNI addons and other third-party things, I foresee never ending duels of controllers flapping between ip_tables and nf_tables endlessly, all trying to vaguely converge on a single stack, but never succeeding. |
When using iptables 1.8.2 in nf_tables mode It seems to work anyway but I can't understand how, or maybe my testing is insufficient. I will try to test better and make sure the ipset's are used so they are not just defined and not used and my tests just happens to work. But is any one can explain the relation between iptables in |
Ipset is only used in proxy-mode=ipvs. I get hits on ipset rules so they work in some way;
|
When using nf_tables mode rules are added indefinitely to the
in both proxy-mode ipvs and iptables. |
I discussed iptables/nft incompatibility in #62720 too, although that was before the iptables binary got rewritten... It seems like for right now, the backward-compatible answer is "you have to make sure the host is using iptables in legacy mode". |
FWIW, I hit this issue as well when deploying Kubernetes on Debian Buster. I've included some logging in #75418. |
this works for me |
The status of this issue is that it was resolved by #82966, if I read correctly, and therefore Kubernetes 1.17 (kube-proxy in 1.17) should work without having to switch the nodes to iptables-legacy? |
The official kubernetes packages, and in particular kubeadm-based installs, are fixed as of 1.17. Other distributions of kubernetes may have been fixed earlier or might not be fixed yet. |
did we wind up backporting this at all? |
no... we'd have to backport the whole rebasing-the-images-to-debian-buster thing which seems like a big change for a point release |
We'd really only need to backport using a new image for kube-proxy and
maybe hyperkube.
…On Mon, Mar 16, 2020, 19:06 Dan Winship ***@***.***> wrote:
no... we'd have to backport the whole rebasing-the-images-to-debian-buster
thing which seems like a big change for a point release
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#71305 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHADK6WSETRQFUO7RYOYT3RH3LLJANCNFSM4GFR5WZA>
.
|
Updated link: |
iptables in RHEL 8 containers is at version 1.8, which is not compatible with a host system at RHEL 7 using iptables 1.4. kubernetes/kubernetes#71305
To get rid of that libvirt error, my permanent workaround in Debian 11 (as a host) with libvirtd daemon is to block the loading of iptables-related modules: Create a file in
Post-analysis: Apparently, I had |
Depends-On: submariner-io/submariner-charts#3 Both iptables and nftables use netfilter framework in the kernel for packet filtering. Many distributions are moving in the direction of using nftables over iptables. Although, nftables uses a new command line utility (named nft), starting from iptables >=1.8, it uses nftables under the hood while continuing to support the same iptables syntax from the user. Quoting from Dan's comment [#] "In iptables 1.8, the maintainers have "deprecated" the classic ip_tables: the iptables tool now does userspace translation from the legacy UI/UX, and uses nf_tables under the hood. So, the commands look and feel the same, but they're now programming a different kernel subsystem. The problem arises when you mix and match invocations of iptables 1.6 (the previous stable) and 1.8 on the same machine, because although they look identical, they're programming different kernel subsystems. Empirically, this causes weird and wonderful things to happen - things like if you trace a packet coming from a pod, you see it flowing through both ip_tables and nf_tables, but even if both accept the packet, it then vanishes entirely and never gets forwarded" So, as long as we are programming either nf_tables or iptables, we would not have any issues. Currently, there is no easy way to identify what type of rules are programmed on the host. This patch follows the same approach (as described here [*]) that is taken in OpenShift where the host file system is mounted inside the docker container and iptables utility on the host is exec'ed for programming any firewall rules. [#] kubernetes/kubernetes#71305 (comment) [*] kubernetes/kubernetes#71305 (comment)
What happened:
When creating nodes on machines with
iptables >= 1.8
kube-proxy is unable initialize and route service traffic. The following is logged:This is compat issue in
iptables
which I believe is called directly from kube-proxy. This is likely due to module reorganization with iptables move to nf_tables: https://marc.info/?l=netfilter&m=154028964211233&w=2iptables 1.8 is backwards compatible with iptables 1.6 modules:
However kube-proxy is based off of debian:stretch which iptables-1.8 may only make it to as part of stretch-backports
How to reproduce it (as minimally and precisely as possible):
Install a node onto a host with iptables-1.8 installed (ex: Debian Testing/Buster)
Anything else we need to know?:
I can keep these nodes in this config for a while, feel free to ask for any helpful output.
Environment:
kubectl version
):libvirt
uname -a
):kubeadm
/kind bug
The text was updated successfully, but these errors were encountered: