-
Notifications
You must be signed in to change notification settings - Fork 22
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
Request API Change: Enable source routing for VIP address on nsm interface #119
Comments
@szvincze thanks for raising this... I figured out what confused me here. All the examples have as first step mucking with adding things to files to enable the use of names for tables... for some reason my brain went tilt and stopped there. @szvincze Do you see any reason not to do this for every Dst/SrcIP ? |
@edwarnicke, thanks for your prompt response. Since then we created a proof of concept based on your proposal, which seems to be working fine. It means we can add VIP as secondary IP-address to the NSM interface. The same VIP can be assigned to different NSM interfaces by updating the connection, however in this case we cannot avoid source routing. |
NSMsourceRoutingT4.pdf <- Here I add the presentation material we used during the NSM Community Meeting today. It explains why is another interface needed besides the primary network, and source routing that can be configured via the API. |
@szvincze Thank you for providing the slides! I think we actually have two things here:
Policy Based Routing (PBR)Currently, we have Connection.ConnectionContext.IPContext.{Src/Dst}Route which basically provides destination based routing. If the dst_ip for a packet is in a prefix in those routes, its routed out the nsm interface. We had started out discussing source based routing, where if a src_ip for a packet is in the source route, we map it out the nsm interface. Now you've brought up wanting to route based on (src_ip, proto)... which gets to a bit more like PBR. My initial thought would be something like this: message PolicyRoute {
string from = 1; /* destination ip address. This must be an IP that NSM has placed on the nsm interface or empty (in which case it applies to all IPs NSM puts on the interface */
uint8 proto = 2; /* ip prototol number */
repeated Route routes = 3; /* list of destination based routes, if empty becomes a default route, but only for things matching both from and proto */
} In order to preserve the principle of "don't break existing networking in the Pod" you can only provide a PolicyRoute that impacts traffic with a src_ip that matches the nsm interface. Thoughts? |
@szvincze Bringing us back to
Generally speaking, we should be adding any IPs/routing prefixes for any existing NSM interfaces in a Pod to the exclude prefix list for any new requests for Network Services for that Pod. This is to avoid mutually ignorant Network Services colliding in terms of ip ranges. Obviously, you have a use case in your slides that for legitimate reasons (shared VIP) does collide. Currently NSM is very dogmatic about presuming mutual ignorance between Network Services. This is a good default assumption. We have slightly over tweaked it though. That presumption is "All Network Services should be treated as mutually ignorant". Looking at your use case it seems that it should instead be "All Network Services should be treated as mutually ignorant unless we have a credible representation that they are not." Let's take an example that may be instructive. Say we have a Pod that is connecting to five Network Services: A,B,C,D,E.
Clearly, B,C,D may not have ip collisions with A,E. But if B,C,D wish to take responsibility for having IP collisions among themselves... well... caveat emptor :) So what we need is a clear way of letting the Connection returned as a response from B,C,D indicate that they are in fact mutually aware of each other and so collisions are OK. The simplest first pass idea I have there would be to provide some sort of field in the returned Connection that could contain some sort of uid that they would all have in common, but not with other things. There are some details to think out here. Would you mind if we opened a separate issue for that discussion? |
@edwarnicke We had a discussion about your idea described above. Actually this is what we need. One addition is that to keep it generic, |
@szvincze Got it. Adding port as well shouldn't be hard. |
@edwarnicke , @szvincze Is this ready to go? |
@denis-tingaikin Yes |
Hi @edwarnicke , @szvincze , I would like to ask couple of questions to understand the use-case better. VIPsOn the slide from this comment I can see couple of VIPs.
SetupBefore implementing policy routes in As per my understanding, a forwarder configures policy routes on a client using I'm using I've tried following cases:
I assume that "1" is NOT what we want. I've tried to configure routes on a client using "2" setup:
This configuration doesn't seem to work. I can see with
|
Hi @sol-0, The problem should be caused by tcptraceroute: Was the src address set tcptraceroute could still miss the proper device as it just loops through the list of interfaces looking for a match: 'ip route get' can be used to verify the route/dev to be picked by the stack:
|
Hi @sol-0 , VIP addresses are not to be seen as virtual interface IPs between clients (NSCs) and endpoints (NSEs). These, what you could term "NSM tunnel endpoint IP-addresses", are to be assigned as normally. The VIP address is an alias/secondary IP-address added to the NSM interface on the client. Actually it could as well have been put on the loopback interface, but if I understand it correctly NSM already supports adding more IP-addresses to the client NSM interface, so we might as well utilize this. The VIP address is a routable address exposed externally to the cluster making it possible to attract and load-balance traffic without NAT'ting the traffic. For outgoing traffic the VIP address is to be used as source IP. Notice that K8s networking normally will direct all traffic via the default route out the primary interface. In order to sent traffic out through the NSM interface the application should bind to the VIP-address and then by the use of Police Based Routing traffic should be directed out the right NSM interface. Therefore the ip rule should also include the VIP as source. ip rule add from [VIP] ipproto tcp dport 8081 table 1 The VIP-addresses are provided by explicit configuration of the NSE. They might originate from a custom resource or from a DNS lookup. But how this is done is outside the scope of NSM. BR |
Traffic with the VIP address as source should exit the POD via the nsmX interface instead of the default interface of the POD.
Currently the VIP address put on the loopback interface and routed by ip rules:
ip rule add from 20.0.0.1/32 table 1
ip route add table 1 nexthop via 167.0.0.1
The text was updated successfully, but these errors were encountered: