kernel load-balancing for docker containers using ipvs

26
IPVS for Docker Containers Andrey Sibiryov Bulldozer Operator at Uber

Upload: docker-inc

Post on 16-Apr-2017

9.616 views

Category:

Technology


6 download

TRANSCRIPT

Page 1: Kernel load-balancing for Docker containers using IPVS

IPVS for Docker Containers

Andrey SibiryovBulldozer Operator at Uber

Page 2: Kernel load-balancing for Docker containers using IPVS

This guy on the stage

2

…who the hell are you and why should we believe a Russian?

Page 3: Kernel load-balancing for Docker containers using IPVS

What is IPVS…and why didn’t we hear about it before?

Page 4: Kernel load-balancing for Docker containers using IPVS

International Pig Veterinary Society

4

Page 5: Kernel load-balancing for Docker containers using IPVS

IP Virtual Server

5

Page 6: Kernel load-balancing for Docker containers using IPVS

IP Virtual Server

6

…and why didn’t we hear about it before?

Page 7: Kernel load-balancing for Docker containers using IPVS

IP Virtual Server

7

Works inside the Linux Kernel, based on Netfilter.Supports TCP, SCTP & UDP, v4 and v6.8+ methods: WRR, WLC, LBLCR, SH and much more – plugins.NAT, Tunneling, Direct Routing.Address bundling via FWMark services.Most importantly, it is bloody fucking fast!

Page 8: Kernel load-balancing for Docker containers using IPVS

IP Virtual Server

8

…and a little bit more about these weird acronyms.

IPIPEncapsulates IP

Routable anywhere

NATRewrites DST IP

Same L4

DSRRewrites DST MAC

Same L2

Page 9: Kernel load-balancing for Docker containers using IPVS

IP Virtual Server

9

…and a few more words about DR since it’s awesome!

TPS

50

66

82

98

114

130

Single IPVS DR HAProxy MySQL Proxy

Page 10: Kernel load-balancing for Docker containers using IPVS

I don’t need this

10

…and why would we load balance and route anything at all?

Page 11: Kernel load-balancing for Docker containers using IPVS

I don’t need this

11

…also, our nginx, haproxy, hipache, vulcand setup works fine – get off the stage, please!

Page 12: Kernel load-balancing for Docker containers using IPVS

I don’t need this

12

…and we run our stuff in the cloud, it takes care of everything – our work is perpetual siesta!

Page 13: Kernel load-balancing for Docker containers using IPVS

IP Virtual Server

13

IPVS NGINX HAPROXY AWS ELB

OSI layer L4 L7 L7 L4TCP ✅ ℹ ✅ ✅

UDP ✅ 🚫 🚫 🚫

Dynamic configuration ✅ 🚫 ℹ ✅

Forwarding methods 4 NAT NAT NATBalancing methods 8+ 3 6 RR

Health checks ✅ 🚫 ✅ ✅

Page 14: Kernel load-balancing for Docker containers using IPVS

What is IPVS…and how do we use it since it sounds so amazing!

Page 15: Kernel load-balancing for Docker containers using IPVS

GORB

15

Go Routing and Balancing

github.com/kobolog/gorb

Page 16: Kernel load-balancing for Docker containers using IPVS

What is GORB

16

…and why is it cool for Docker Containers?

Page 17: Kernel load-balancing for Docker containers using IPVS

17

REST API daemon to control IPVS.Simple GET, PUT, DELETE interface.Docker Link to control GORB.TCP, HTTP health checks built-in.Written in Go, LGPL licensed, on GitHub.Docker + GORB + MacVLAN network plugin + IPVS DR forwarding mode = ❤

What is GORB…and why is it cool for Docker Containers?

Page 18: Kernel load-balancing for Docker containers using IPVS

What is GORB…and how do we use it? Live demo or GTFO!

Page 19: Kernel load-balancing for Docker containers using IPVS

What is GORB

19

The guy on the stage is doing roughly this right now.

kobolog@gorb:~$ go install github.com/kobolog/gorb

kobolog@gorb:~$ sudo modprobe ip_vs

kobolog@gorb:~$ sudo gorb &

kobolog@docker:~$ go install github.com/kobolog/gorb/gorb-docker-link

kobolog@docker:~$ export DOCKER_HOST=<...>

kobolog@docker:~$ gorb-docker-link -r gorb:4672 &

kobolog@docker:~$ docker run -d -p 80 nginx

kobolog@gorb:~$ curl -i -XGET http://localhost:80

Page 20: Kernel load-balancing for Docker containers using IPVS

A few more words about BGP

20

…black belt in networking is not complete without a few words about BGP.

Page 21: Kernel load-balancing for Docker containers using IPVS

How stable is GORB

21

…and is it production-ready? Can we blame you if it doesn’t work?

Page 22: Kernel load-balancing for Docker containers using IPVS

«I'll let you in on a secret: my pet hamster did all the coding. I was just a channel, a «front» if you will, in my pet's grand plan. So, don't blame me if there are bugs. Blame the cute, furry one» —Rusty Russel

22

Page 23: Kernel load-balancing for Docker containers using IPVS

€25,000

23

…is the price for an enterprise hardware load-balancer.

Page 24: Kernel load-balancing for Docker containers using IPVS

€0

24

…is a price for IPVS and BGP (and GORB).

Works on commodity hardware.No special software or tools, no SNMP.1000-word man page vs. 1000-page vendor manual.1 GBPS line rate = 1% CPU in DR mode.IPVS is around for more than 15 years.

Page 25: Kernel load-balancing for Docker containers using IPVS

25

A good way to spend €25,000

Page 26: Kernel load-balancing for Docker containers using IPVS

Thank you!Andrey Sibiryov@kobolog [email protected]