Service load balancing internally across all clients


I’m totally noob on the Nomad, was reading the documentation last day and checking if it suits my use case.

I have few questions on which I’m still confused. I’ve started looking into the Nomad because it is more lightweight and simpler than kube, so I’m mainly focusing only on what can be achieved using solely Nomad (without Vault or Consul).

I see that Nomad has built-in service discovery, and it can be used like in the example below:

{{ range service "demo-webapp" }}
  server {{ .Address }}:{{ .Port }};
{{ else }}server; # force a 502
{{ end }}

In kube I can simply access service using DNS with single hostname. How I would achieve this using Nomad. I’m having front-end app that needs an access to the backend API. How I would reach it if backend is allocated across multiple Nomad clients? I will have multiple different IPs in that case which I can’t use in my front-end app, because I need single hostname.

I add internal load balancer like Nginx, use built-in SD to list all addresses in there and reach Nginx service internally using single IP address? Or there is another way to do so? In other words what are best practises for this typical use case?

Another question if I will use Nginx for internal service load balancing, what would happen if one of the service becomes not healthy or service gets redeployed. Will I experience short downtime for Nginx service (because of configuration update)?

I know it might sound stupid, but coming from Kube I’m little confused how networking and best practises are working in Nomad.