Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with new Multi Interface Networking Feature with same ports to different interfaces. #8891

Closed
hongkongkiwi opened this issue Sep 16, 2020 · 4 comments · Fixed by #9946

Comments

@hongkongkiwi
Copy link

Nomad version

Nomad v0.12.4

Operating system and Environment details

Linux edge0 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Issue

I would expect the following configuration to work, however Nomad complains of a collision. This is actually not true, but nomad gets confused as previously without multi interface networking this would have collided.

Nomad Job

    network {
      mbits = 10
      mode = "bridge"
      port "http" {
        static = 80
        host_network = "public"
      }
      port "https" {
        static = 443
        host_network = "public"
      }
      port "http" {
        static = 80
        host_network = "localhost"
      }
      port "https" {
        static = 443
        host_network = "localhost"
      }
    }

Nomad Config

{
....
  "client": {
    "enabled": true,
    "host_network": {
      "private": {
        "interface": "eth1",
      },
      "public": {
        "interface": "eth0",
      },
      "localhost": {
        "interface": "lo"
      }
    }
....
}

When attempting the above job, which I would expect to work however it shows:
error parsing 'job': group: network, ports -> found a port label collision: http

@hongkongkiwi hongkongkiwi changed the title Problems with new Multi Interface Networking Feature Problems with new Multi Interface Networking Feature with same ports to different interfaces. Sep 16, 2020
@fwkz
Copy link
Contributor

fwkz commented Sep 25, 2020

I got a slightly different problem but I feel like it might be related. I want to bind ports on separate interfaces to the same port inside docker container. Such a thing is not hard to do it manually.

docker run -p 192.168.10.10:1111:5000 -p 192.168.11.10:2222:5000 some_docker_image

Unfortunately, I can't get the same behavior using nomad.

# nomad-client.hcl
host_network "users" {
  cidr            = "192.168.10.0/24"
  reserved_ports  = "0-1023,49152-65535"
}
# nomad-job.hcl
group "foo" {
  
  network {
    port "internal" {
      to = 5000
    }
    port "users" {
      to = 5000
      host_network = "users"
    }
  }

  task "bar" {
    driver = "docker"
    config {
      ports = ["internal", "users"]
    }
  }
}

Port 5000 is bound only to port internal on default interface, port users on host_network users is ignored.

@nickethier
Copy link
Member

Hey @hongkongkiwi I'm having a hard time trying to understand the usecase for why the port labels need to share the same name. For example if you were to define a service with port="http" it would be ambiguous as to which address Nomad should register with Consul.

@nickethier
Copy link
Member

@fwkz that issue is being tracked in #8284

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants