Load Balancing with NGINX Exmaple not Working

Hi, I tried load-balancing-nginx on my local maschine:

Linux: 5.11.11-arch1-1
Docker: 20.10.5

I started Consul and Nomad in Dev mode. When I read the rendered config I see:

nomad alloc fs acb nginx/local/load-balancer.conf

Summary

upstream backend {

server 127.0.0.1:20242;

server 127.0.0.1:22908;

server 127.0.0.1:31949;

}

server {
listen 8080;

location / {
proxy_pass http://backend;
}
}

That obviously does not work. Tthe forward in the Ngix contianer does not work because it is trying to forward to 127.0.0.1.

Does anyone has an idea how to solve that?

Regards,
Alfred

Hi @Alfred,

When running Nomad and Consul in dev mode, they both will bind and advertise on localhost which is causing the problems you are seeing. In order to update this and thus resolve the problem I would suggest passing the Nomad bind_addr and Consul bind_addr when starting the applications. Alternatively the Learn guide details this Terraform setup that will provide you with a cluster configured in the desired manner.

Thanks,
jrasell and the Nomad team