-
Notifications
You must be signed in to change notification settings - Fork 192
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
Submariner doesn't work with Calico CNI #407
Comments
Possible related to #272 |
Did you get around this? I am facing the same problem, connecting to services work fine even if the pods are on non-gateway nodes but not pod-pod communication if the destination pod is not in the gateway node. |
not yet, meantime we have moved to another CNI, probably will return to Calico later. |
Hm, yeah Calico is pretty aggressive in inserting its rules at the top, in order to prevent other applications from bypassing network policy enforcement, which would be bad. I'm not too familiar with submariner - what do the submariner rules do / look like? We might be able to make changes to make these two play nicer together. |
Welcome @caseydavenport! /cc @sridhargaddam @mangelajo |
I had problems with disabling calico NAT only for cross cluster communication.
|
Basically, inorder to support Cross-Cluster communication and to preserve the source-ip of the PODs across the clusters, Submariner programs certain iptable rules (PFA the list of rules in the attached file). Submariner requires these rules to be applied prior to the rules programmed by the respective CNI. Also, JFYI the rules programmed by Submariner only affects the inter-cluster traffic and will not affect the local cluster traffic. So, initially when Submariner is deployed, it installs certain rules ahead of existing rules programmed by CNI. Sample example: However, after a brief amount of time, the SUBMARINER-POSTROUTING rule in POSTROUTING chain ceases to become the first rule in the chain and this affects the Submariner use-cases. Chain POSTROUTING (policy ACCEPT 2 packets, 120 bytes) |
Thank you @caseydavenport for looking into it. Please see my comment above. Also, if you are interested in taking a look at the source-code in Submariner, here is the link -
|
Right, so in the example file you gave above it looks like these are the rules that submariner programs (more or less, probably varies a bit by cluster). The first seems to SNAT the cross cluster traffic, like you're describing. This is probably OK - it's only performed on the encapsulated packet, leaving the original pod source IP intact, IIUC? The other rules afterwards appear to be allowing traffic from other clusters that are destined to local cluster CIDRs - is that right? Those ones are more worrying to me, because if they are put in front of Calico's rules they will accept all pod-to-pod traffic, bypassing Calico's policy enforcement. What are those rules for? |
Sorry, @caseydavenport I missed your comment. PSB When you deploy a KIND based cluster in Submariner, it deploys three clusters one as an independent broker (i.e., cluster1) and the other two as data clusters (cluster2 and cluster3)
Submariner programs the following rules in the SUBMARINER-POSTROUTING chain of NAT table on Cluster2 nodes.
In the above SUBMARINER-POSTROUTING chain, rule number 1 is to support connectivity from Host itself (or a POD that uses HostNetworking=true) to a remoteService in another submariner connected cluster. Rule number 2/3/4 are mainly to allow inter-cluster traffic (i.e., POD to POD or POD to remoteService) between the submariner connected clusters. Regarding Network Policies, as you know, not all CNIs support NetworkPolicies. We verified Submariner+K8sNetworkPolicies with weavenet as well as openshift-sdn and it works as expected. Let me take an example of Weavenet CNI. In Weave, when we program NetworkPolicies, they are translated to iptable rules in Filter table, forwarding chain (i.e., WEAVE-NPC-INGRESS).
|
@sridhargaddam @caseydavenport can you share what it the latest status of this Issue? We just had one more user asking about Calico support on Slack. Thanks! |
@caseydavenport, Let me know if you need any additional info regarding Submariner. I'm (along with the Submariner team) are available on #submariner slack channel on Kubernetes. If required, we can also have a Bluejeans session. Thanks. |
Really sorry for the long delay on this one guys... too much going on for as long as I can remember 😅
No, you're correct here in that Calico does most of its policy enforcement in the FILTER table when running with the iptables dataplane driver. So at that level is fairly similar to how weavenet is programming its policy. There are three classes of traffic that Calico handles in the cali-POSTROUTING chain.
Given that:
Does that make sense? Am I missing something? I joined the #submariner channel in Slack so we can continue the conversation there if you'd like! |
No problem @caseydavenport and thank you for the detailed info.
Yes, it makes sense and we can give it a try to see if it works. So, if I understood your suggestion properly, you are suggesting that we can create the following IPPool on WestCluster for allowing connectivity to Services in EastCluster (similarly on the East cluster). Is this correct?
|
@sridhargaddam yes, that IP pool looks right to me! Assuming my understanding of the issue is correct, that should configure Calico to stop performing NAT on traffic destined to pods in the other cluster. |
@caseydavenport, as discussed, I configured necessary IPPools with remoteCIDRs in two KIND Calico Clusters joined with Submariner and can see that a Pod in West Cluster is able to talk to Pod/Service in East Cluster :-) However, when I tried to deploy Submariner Globalnet (a feature that allows joining clusters with Overlapping CIDRs), with default globalnet-cidr* which is 169.254.0.0/16, I'm not able to create the IPPool with 169.254.0.0/16 CIDR. I'm getting the following error.
This is not a major issue since we can override the --globalnet-cidr (to non-IPv4 LLA) when installing Submariner. But I'm interested to know if there is a way to allow this in Calico. Thanks once again. |
Hm, interesting. Calico uses some link-local addresses itself so it prevents them from being allocated as pod IPs. I'll do some more reading on the Globalnet functionality, but for now selecting a different CIDR seems like a reasonable workaround. |
This was tested with v0.6, see https://submariner.io/deployment/calico/ |
Calico CNI supports several networking modes.
IP in IP or VXLAN encapsulation
.After successful submariner installation (disable-nat), I was able to ping from a pod which is colocated with the submariner gateway to pods on another cluster, but was not able to ping services.
Pings from a pod which is not colocated with the GW, achieved neither pods nor services on another cluster.
BGP peering
mode.In this case I was able to ping only from a pod colocated with a GW to pods colocated with another GW on the second cluster.
Looks like Calico puts its rules before submariner's in iptables.
The text was updated successfully, but these errors were encountered: