HAProxy and service discovery

In this section, we use service discovery to create a web service that has multiple backend nodes with HAProxy frontend and then load balancing the service requests. HAProxy is a commonly used load balancer for TCP and HTTP-based applications.

Let's start by understanding a typical HAProxy configuration. We are not going to cover the HAProxy configuration exhaustively, but will only concentrate on the configurations that are relevant for service discovery:

frontend testloadbalancer
    bind *:80
    mode http
    balance roundrobin
    server testserver01 172.17.18.101:80 check
    server testserver02 172.17.18.102:80 check

This configuration instructs HAProxy to bind to port 80 and forward HTTP traffic to the servers 172.17.18.10 ...

Get Learning CoreOS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.