-
Notifications
You must be signed in to change notification settings - Fork 792
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
portmap plugin's iptables rules intercept kubernetes service traffic #222
Comments
The challenge is to figure out an iptables condition that matches only the exact traffic we want. That's why I added the |
Hm... it doesn't seem like the service CIDR route should be
I guess that depends on whether you consider those to be alternative local IPs or
I think what you want is "is addressed to the IP address of any network interface on the host" but if |
In my testing, I notice after enabling kube-proxy IPVS mode, when a pod with a hostport (i.e. portmap) runs on a node, it prevents service IP access (from both the host node and any pods on it). I've reproduced this with both Calico and Flannel (both of which use |
Aha, IPVS - that's something I hadn't considered. I wonder if we're racing on rules. I suspect we'll either need to write a separate |
Well, but then you're just potentially broken on every other platform that uses CNI besides kubernetes... Ideally, the portmap plugin (and each other iptables user) would intercept only the packets it actually wanted, and then ordering wouldn't matter. Alternatively, maybe something like my |
@danwinship any word if there was any progress with this issue? 🙏 |
No. (I'm not working on this, I was just reporting the bug after having reviewed a kubernetes PR that was trying to fix the problem in the wrong way.) Presumably if there was progress there would be updates here or in the linked kube bug, so you can subscribe to those. |
@squeed Do you know there is any plan to fix this issue? |
ping @squeed 😄 |
The portmap code assumes that
--dst-type LOCAL
will only match traffic addressed to the node's own IP addresses. However, at least under some configurations, it will end up matching traffic to addresses in the kubernetes service range as well. As a result, if you have, eg, a pod that claims hostport 443, it might end up receiving traffic that was sent to 172.30.0.1:443 by pods on the same node.As seen in kubernetes/kubernetes#66103. It's not clear if this depends in some way on how the network plugin sets up routing to the service network, or if it happens all the time for any plugin that uses the portmap plugin.
The text was updated successfully, but these errors were encountered: