Skip to content

host_network (using Nebula) vs. DNS #9006

Description

@PLandbo

Issue

We are have a problem where the host_network doesn't act as I think it should.
Maybe this is related to #8432 ?
Nameservice does not return Nebula IP, but Public IP.

Nomad version

Nomad v0.12.5

Operating system and Environment details

Ubuntu 20.04 LTS
3 server nodes
1 client node
All 4 nodes are VPS'
1 public IP on each
1 Nebula network privat addresse on each

Reproduction steps

So, in short, we want to run all on our Nebula network.

As a test we've set up a PgBouncer service (Docker).

The service runs fine - but nameservice return Public IP - not the Nebula IP

I would expect the service to be announced on "default" = 192.168.100.5 but DNS tells me otherwise:

; <<>> DiG 9.16.1-Ubuntu <<>> @localhost -p 8600 pgbouncer.service.consul
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53682
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;pgbouncer.service.consul. IN A

;; ANSWER SECTION:
pgbouncer.service.consul. 0 IN A 49.X.Y.Z

;; Query time: 4 msec
;; SERVER: 127.0.0.1#8600(127.0.0.1)
;; WHEN: Thu Oct 01 11:40:43 CEST 2020
;; MSG SIZE rcvd: 69

Nomad client node host_network setup:

...

host_network "public" {
  cidr = "49.X.Y.Z/32"
  interface = "eth0"
}

host_network "default" {
  cidr = "192.168.100.5/22"
  interface = "nebula1"
}

}

Job file (if appropriate)

job "pgbouncer" {
  datacenters = ["dc2"]
 
  type = "service"

  group "pgbouncer" {
  count = 1
  network {
    mode = "bridge"
      port "db" {
         host_network = "default"
         static = 6432
         to = 6432
      }
  }

  service {
    name = "pgbouncer"
    port = "db"
  }

  task "pgbouncer" {
    driver = "docker"
    config {
      image = "pgbouncer/pgbouncer:1.14.0"
  }

  env {
    DATABASES_HOST = "192.168.101.4"
    DATABASES_PORT = 5432
    DATABASES_USER = "postgres"
    DATABASES_PASSWORD = "<password>"
    DATABASES_DBNAME = "<dbname>"
    PGBOUNCER_LISTEN_PORT = 6432
  }
}

}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions