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.
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:
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:
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:
Check out the full track of load balancer integrations on HashiCorp Learn.
Learn the installation and verification workflow for any Linux distribution that does not include HashiCorp software in its package repository.
Learn how JWT-based authentication works in HashiCorp Nomad using a custom GitHub Action as an example of machine-to-machine authentication.
Managing multiple clusters of HashiCorp tools can be complicated. Target CLI eases the burden by using context profiles to easily switch between different clusters and environments.