Comments (8)
This is most efficient mode to use, but unfortunately there are constraints due to which its very non-trivial to achieve.
Please see http://www.linuxvirtualserver.org/VS-DRouting.html
https://www.centos.org/docs/5/html/Virtual_Server_Administration/s2-lvs-directrouting-VSA.html
http://www.austintek.com/LVS/LVS-HOWTO/HOWTO/LVS-HOWTO.arp_problem.html
We need L2 adjacency between the IPVS/LVS director and real server. In the context of kubernetes it means each node need to have L2 adjacency to pods running on same or different nodes. As i understand we need to do some trickery (not sure even its possible) as container network is overlaid on node network.
Please use ipvsadm to try the scenario to see even its possible. I could not figure a way.
Also please see https://www.youtube.com/watch?v=KJ-A8LYriGI&t=204s, though it seems more like for north-south traffic.
Current container orchestration platforms (Docker swarm, Meso Minuteman) that uses IPVS does not support DR mode either. Please see if there are any efforts in those project to get DR mode.
from kube-router.
Adding a WIP design done by @thoro
masquerading with asymetric routing
from kube-router.
Elegent solution for DSR(Direct Server Return) in Microsoft Ananta
Take a look at Fig 7. It can be applied to kube-router as below.
Packet flow for the first packet
step1: client->service vip
step2: Node select an endpoint performs IP-IP encap with same source, and destination as pod IP
step3: Destination node intercept perform decapsulation send packet to pod
step4: pod gets the packet, respond directly to the client IP.
Each node to need to be aware of the flows and need to be consistent hashing for subsequent packets as detailed in the paper.
from kube-router.
Figure 2 of google's maglev they use GRE for DSR
from kube-router.
How Facebook does DSR with IP-IP 11.00 to 16.00 https://www.usenix.org/conference/srecon15europe/program/presentation/shuff
from kube-router.
Use of DSCP to achive DSR.
from kube-router.
This post also describes Facebook's solution: https://www.facebook.com/notes/facebook-engineering/under-the-hood-network-implementation-for-world-ipv6-launch/10150873176303920/
from kube-router.
IPVS Configuration for FWMARK service with DSR
iptables:
iptables -t mangle -A PREROUTING -d 185.208.132.3 -m tcp -p tcp --dport 333 -j MARK --set-mark 5
iptables -t mangle -A OUTPUT -m mark --mark 5 -d 10.253.10.12 -j DSCP --set-dscp 3
ip rule add iif eth0 fwmark 0x5 lookup 100
ip route add local default dev lo table 100
<-- here it's necessary to put the ingress interface, or the fwmark is deleted on output, otherwise the packet is routed again to lo, and be careful with the route, to really add it to the table, otherwise you kill the IP connectivity ;)
ipvsadm:
ipvsadm -A --fwmark-service 5
ipvsadm -a --fwmark-service 5 -r 10.253.10.12:333 --masquerading
<-- here it's important that a port is defined, otherwise 0 is used and the packet is dropped
pod iptables:
iptables -A INPUT -m dscp --dscp 3 -j DSTWRITE --to-destination 185.208.132.3
if you leave out the two rules with dscp the current ipvsadm behaviour stays.
from kube-router.
Related Issues (20)
- v2.1.1: TCPMSS not setup with DSR HOT 2
- Bug in network policy ipsets when using dualStack HOT 2
- . HOT 1
- Initial BGP sync during kube-router startup extremely slow in kubernetes v1.29 HOT 6
- /var/lib/kube-router/kubeconfig does not regenerate when configmap changes are made HOT 3
- kube-router crashloop backoff without obvious cause on brand new cluster HOT 8
- v2.1: DSR+TCPMSS with non-ready services not set-up correctly HOT 6
- Globally enable hairpin mode for externalIPs HOT 2
- kube-router should cleanup rules it does not handle anymore in its chains HOT 2
- kube-router duplicates rules in the KUBE-ROUTER-INPUT chain HOT 3
- Custom ipset sets and entries get reverted periodically HOT 12
- Creating LoadBalancer service blocks API server IP HOT 12
- IPv6 Error: `unknown option "--icmpv6-type"`
- Unable To Route to IPv6 Service VIPs from Same Node
- Service traffic being dropped when NetworkPolicy is present HOT 2
- Unknown option "--icmp-type" HOT 3
- Seeking New Maintainers HOT 3
- documentation/DSR examples: mount directory containing the socket instead the socket directly HOT 2
- Race condition between netpol and IPVS based ipset updates
- kube-router Holding on to Routes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kube-router.