Configuring Nomad Jobs with Environment Variables in Private Networks instead of Public

When attempting to use environment variables, as specified in the Nomad documentation, to configure Nomad Jobs, I am encountering challenges. Despite running my Nomad Cluster within a private network configuration, each node in the cluster also has a network interface connected to the public internet.

As an illustration, a portion of my master instance configuration appears as follows:


bind_addr = ""

server {
  enabled          = true
  bootstrap_expect = 3

advertise {
  http = ""
  serf = ""
  rpc  = ""

Despite this configuration specifying private network IP addresses, when attempting to use environment variables such as IP_ADDR_{port} (e.g., IP_ADDR_http), Nomad uses the public IP address of the node instead of the private one. Where do i need to apply changes so Nomad uses the private addresses of the nodes instead of the public addresses.

Thanks in advance :slight_smile:

Set the network_interface property in the client block in the configuraton to the interface that has the private IP on it, and Nomad will use that to schedule all jobs.

I think alternatively you can play with host_network (once configured, of course) to force a job onto a particular network defined on the host (i.e. public or private).

That worked ! Thank you very much :slightly_smiling_face: