I have a Nomad cluster with 2 nodes.
I want to be able to deploy some application and access it through “.gbt55.es” which is my own domain.
So basically:
- Deploy a load balancer that is transparent and can redirect requests to both nodes.
- Deploy a job regardless of which node it is on.
- Configure my domain “.gbt55.es” in the .hcl of the job.
- Access it on “.gbt55.es”.
Is this possible in Nomad?
I can share what I did in my homelab for load-balancing. Also have two compute nodes, plus one arbiter (VM on my NAS) to add some resilency to my cluster.
- run keepalived on my compute nodes which assigns a floating IP (192.168.0.3) to one of my compute nodes.
- run Consul ingress gateway on both compute nodes for ports 80 and 443.
- run Traefik on one of the nodes (does not matter which), with services for http and https
- instruct Consul IG to route the traffic to the Traefik http and https services.
- Traefik will then reverse proxy the incoming traffic based on Traefik rules in the actual service job files
This way, traffic to the floating IP will end up on the compute node which currently uses the floating IP. Does not matter which one, Consul IG is running on both, will receive the traffic and route to Traefik first and from there to the destination service.
Just configure your router to forward port 80 and 443 to the floating IP.
See:
The Traefik job file is a bit complicated, since it is defining two instances … one for my internal network and one for external access via Cloudflare tunnel.
1 Like