Marathon-LB

Marathon-LB

Marathon-LB is based on HAProxy, a rapid proxy and load balancer. HAProxy provides proxying and load balancing for TCP and HTTP based applications, with features such as SSL support, HTTP compression, health checking, Lua scripting and more. Marathon-LB subscribes to Marathon’s event bus and updates the HAProxy configuration in real time.

You can can configure Marathon-LB with various topologies. Here are some examples of how you might use Marathon-LB:

  • Use Marathon-LB as your edge load balancer and service discovery mechanism. You could run Marathon-LB on public-facing nodes to route ingress traffic. You would use the IP addresses of your public-facing nodes in the A-records for your internal or external DNS records (depending on your use-case).
  • Use Marathon-LB as an internal LB and service discovery mechanism, with a separate HA load balancer for routing public traffic in. For example, you may use an external F5 load balancer on-premise, or an Elastic Load Balancer on Amazon Web Services.
  • Use Marathon-LB strictly as an internal load balancer and service discovery mechanism.
  • You might also want to use a combination of internal and external load balancers, with different services exposed on different load balancers.

Here we discuss Marathon-LB as an edge load balancer and as an internal and external load balancer.

Marathon-LB as an edge load balancer

lb1

Marathon-LB as an internal and external load balancer

lb7

Learn More

More information for Marathon-LB can be found on the GitHub page.


Marathon-LB for Externally Load Balanced App

This tutorial shows you how to use Marathon-LB to run a containerized DC/OS service that serves a website. Specifically, you will use Docker image that contains NGINX, which serves the dcos.io site.

    Marathon-LB for Internal and External Load Balancing

    In this tutorial, Marathon-LB is used as an internal and external load balancer. The external load balancer is used to route external HTTP traffic into the cluster, and the internal load balancer is used for internal service discovery and load balancing. Since we’ll be doing this on AWS, external traffic will first hit an external load balancer configured to expose our “public” agent nodes.

      Marathon LB Reference

      Marathon-LB works by automatically generating configuration for HAProxy and then reloading HAProxy as needed. Marathon-LB generates the HAProxy configuration based on application data available from the Marathon REST API. It can also subscribe to the Marathon Event Bus for real-time updates. When an application starts, stops, relocates or has any change in health status, Marathon-LB will automatically regenerate the HAProxy configuration and reload HAProxy.