Skip to main content

Integrating Third-Party Load Balancers with Nomad: NGINX, HAProxy, Traefik

Trying to manually deploy and configure your load balancers in a dynamic infrastructure can be overwhelming. As you deploy and increase the scale of your microservices, your load balancers will need a way to keep up with the IP addresses of your application instances. Fortunately, Nomad (along with its powerful integration with Consul), automates this process and works seamlessly with many popular load balancers such as NGINX, HAProxy, and Traefik.

»NGINX Integration Using Template Stanza

Nomad uses the Consul Template tool in its template stanza. This allows Nomad to populate values from Consul and Vault, in addition to Nomad's runtime environment variables.

Using the template stanza, Nomad can populate NGINX's configuration with the IP addresses of healthy service instances. Try out the integration with the following guide:

Load Balancing with NGINX

»HAProxy Native Integration

HAProxy version 1.8+ (LTS) includes the server-template feature, which lets users specify placeholder backend servers to populate HAProxy’s load balancing pools. Server-template can use Consul as one of these backend servers, requesting SRV records from Consul DNS. Try out the following guide to learn more:

Load Balancing with HAProxy

»Traefik Native Integration with Consul Catalog Provider

Traefik can be configured to use the Consul Catalog Provider and natively integrate with your Consul services while allowing you to use tags to route your traffic. Learn more with the following guide:

Load Balancing with Traefik

»Learn More

Check out the full track of load balancer integrations on HashiCorp Learn.


Sign up for the latest HashiCorp news

By submitting this form, you acknowledge and agree that HashiCorp will process your personal information in accordance with the Privacy Policy.