Kube-router: Feature: L3 ECMP + L4 director + DSR

Created on 22 Sep 2017  路  4Comments  路  Source: cloudnativelabs/kube-router

Consolidatng one blanket bug to track serveral sub-features to achieve highly available, scalable ingress model for bare-metal deployments.

       ECMP/L3 LB                    consistent hash
Router -------------> L4 director-------------------> L7 proxy--------------> pod

or

       ECMP/L3 LB                    consistent hash
Router -------------> L4 director-------------------> pod
  • [x] define a custom service annotation to indicate service needs DSR
  • [x] ability to advertise external ip's #161 if service is marked with annotation
  • [x] support consistent hashing for IPVS service #166 is marked with annotation
  • [x] Ability to create IPVS service with FWMARK's if service is marked with annotation
  • [x] Ability to create IPVS service with IPIP tunnel mode
  • [x] add additional tunnel interface inside the service endpoint pod, and configure the external ip
enhancement

Most helpful comment

I am working on a prototype. Will share once i have something in testable state, for feedback.

Here are the manual steps. Assuming 192.168.100.101 is the external IP and 10.1.1.56 is service endpoint

iptables -t mangle -A PREROUTING -d 192.168.100.101 -m tcp -p tcp --dport 80 -j MARK --set-mark 10
ipvsadm -A --fwmark-service 10 -s sh
ipvsadm -a --fwmark-service 10 -r 10.1.1.56 -i

get the pid of the pod by container id

docker inspect --format '{{.State.Pid}}' 292a9274a97d

add the tunnel interface inside the pod

 nsenter -t 2358 -n ip tunnel add tunnel0 mode ipip local 10.1.1.56

add the vip to tunl0 interface

 nsenter -t 2358 -n ip addr  add 192.168.100.101 dev tunl0

Last disable rp_filter on container, as packet arrives on tunnel interface and leaves on the eth0

nsenter -t 2358 -n sysctl -w net.ipv4.conf.all.rp_filter=0

All 4 comments

I am working on a prototype. Will share once i have something in testable state, for feedback.

Here are the manual steps. Assuming 192.168.100.101 is the external IP and 10.1.1.56 is service endpoint

iptables -t mangle -A PREROUTING -d 192.168.100.101 -m tcp -p tcp --dport 80 -j MARK --set-mark 10
ipvsadm -A --fwmark-service 10 -s sh
ipvsadm -a --fwmark-service 10 -r 10.1.1.56 -i

get the pid of the pod by container id

docker inspect --format '{{.State.Pid}}' 292a9274a97d

add the tunnel interface inside the pod

 nsenter -t 2358 -n ip tunnel add tunnel0 mode ipip local 10.1.1.56

add the vip to tunl0 interface

 nsenter -t 2358 -n ip addr  add 192.168.100.101 dev tunl0

Last disable rp_filter on container, as packet arrives on tunnel interface and leaves on the eth0

nsenter -t 2358 -n sysctl -w net.ipv4.conf.all.rp_filter=0

Support for DSR: cloudnativelabs/kube-router@6d43268
Support for external IP鈥檚: cloudnativelabs/kube-router@ba7697b
Support for advertising external IP鈥檚: to BGP peers cloudnativelabs/kube-router@4ca0afa

You gentlemen are on 馃敟 please do keep it up!

We have all pieces of puzzle for this feature. I will use #88 to document how to use these individual features.

Only thing that could have been better is use proper consistent hashing, which is not available in stock LVS. We will need patched version.

For now SH (Source Hashing) support has been added in https://github.com/cloudnativelabs/kube-router/commit/77f45e356ba58c81f45f54d98fe8293ad586f38b

Was this page helpful?
0 / 5 - 0 ratings