Upload
bartspaans
View
733
Download
0
Embed Size (px)
Citation preview
Bespoke Service Discovery
With HAProxy and Marathon on Mesos
Bart Spaans@Work_of_Bart
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
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
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
Our requirements
▷ Transparent to clients▷ Name based discovery▷ No DNS caching issues▷ Minimal network hops▷ No SPOF
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
▷ 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?
▷ 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
Finding the back-end
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 ○ ….
Cons▷ HTTP/HTTPS mode only▷ Scaling to hundreds of nodes▷ Cron-job
ThanksBart Spaans
@Work_of_Bart
@OpenCredo
Slides will be there ^
http://www.opencredo.com/