bespoke service discovery with haproxy and marathon on mesos

13
Bespoke Service Discovery With HAProxy and Marathon on Mesos Bart Spaans @Work_of_Bart

Upload: bartspaans

Post on 18-Jul-2015

727 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Bespoke service discovery with HAProxy and Marathon on Mesos

Bespoke Service Discovery

With HAProxy and Marathon on Mesos

Bart Spaans@Work_of_Bart

Page 2: Bespoke service discovery with HAProxy and Marathon on Mesos

Sedex

Ethical supply chain management

Not-for-profit

Looking for a scalable, cost-effective, future-proof solution

OpenCredo

London based software consultancy

Solutions based on leading edge technologies

Page 3: Bespoke service discovery with HAProxy and Marathon on Mesos

A quick intro to Mesos

▷ Mesos is a cluster resource manager

▷ It tracks resources (CPU, RAM, …) available in the cluster

▷ And offers these resources to frameworks

Page 4: Bespoke service discovery with HAProxy and Marathon on Mesos

A quick intro to Mesos

▷ Mesos is a cluster resource manager

▷ It tracks resources (CPU, RAM, …) available in the cluster

▷ And offers these resources to frameworks

▷ We use the Marathon framework to deploy, run and scaleDocker containers

Page 5: Bespoke service discovery with HAProxy and Marathon on Mesos
Page 6: Bespoke service discovery with HAProxy and Marathon on Mesos

Our requirements

▷ Transparent to clients▷ Name based discovery▷ No DNS caching issues▷ Minimal network hops▷ No SPOF

Page 7: Bespoke service discovery with HAProxy and Marathon on Mesos

HAProxyProxy based on hostname:

frontend http bind *:80 mode http acl host_hello hdr(host) -i helloworld.sedexonline.com use_backend hello-world if host_hello

backend hello-world balance source server hello-world-00 10.0.20.2:31013 check server hello-world-01 10.0.20.6:31011 check

Page 8: Bespoke service discovery with HAProxy and Marathon on Mesos

▷ We have moved our problem from ‘where is my application’ to ‘where is my proxy’

▷ Solution: put a proxy on each node

How to find the proxies?

Page 9: Bespoke service discovery with HAProxy and Marathon on Mesos

▷ Our containers can reach the proxy, but how?▷ We need to manipulate the hosts file

Host resolution

$ cat /etc/hosts

127.0.0.1 hello-world.sedexonline.com127.0.0.1 hello-london.sedexonline.com

Page 10: Bespoke service discovery with HAProxy and Marathon on Mesos

Finding the back-end

Page 11: Bespoke service discovery with HAProxy and Marathon on Mesos

Pros▷ We don’t have to change legacy applications▷ HTTPS is trivial to add▷ We get load balancing “for free”▷ HAProxy features:

○ sticky sessions○ URL rewriting○ header manipulation ○ ….

Page 12: Bespoke service discovery with HAProxy and Marathon on Mesos

Cons▷ HTTP/HTTPS mode only▷ Scaling to hundreds of nodes▷ Cron-job

Page 13: Bespoke service discovery with HAProxy and Marathon on Mesos

ThanksBart Spaans

@Work_of_Bart

@OpenCredo

Slides will be there ^

http://www.opencredo.com/