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

Only one IP is recognized on host_network #23693

Closed
sbenoistmics opened this issue Jul 26, 2024 · 4 comments · Fixed by #23702
Closed

Only one IP is recognized on host_network #23693

sbenoistmics opened this issue Jul 26, 2024 · 4 comments · Fixed by #23702

Comments

@sbenoistmics
Copy link
Contributor

sbenoistmics commented Jul 26, 2024

Nomad version

Nomad v1.8.0
BuildDate 2024-05-28T17:38:17Z
Revision 28b82e4

Operating system and Environment details

Linux XXX 5.10.0-31-amd64 #1 SMP Debian 5.10.221-1 (2024-07-14) x86_64 GNU/Linux

Issue

Even if you have two valid IP on the host network, only the first one is used for placement.
You cannot use both IP to allow application with non configurable port to be on the same host

Reproduction steps

In nomad client config add the network :

  host_network "scylla" {
    cidr           = "10.0.1.248/30"
    reserved_ports = "22,80"
  }

Have a host with two IP in that cidr configured, e.g.:

4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:9b:e1:25 brd ff:ff:ff:ff:ff:ff
    altname enp0s9
    inet 10.0.1.249/24 brd 10.0.1.255 scope global eth2
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe9b:e125/64 scope link 
       valid_lft forever preferred_lft forever
5: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:55:be:98 brd ff:ff:ff:ff:ff:ff
    altname enp0s10
    inet 10.0.1.250/24 brd 10.0.1.255 scope global eth3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe55:be98/64 scope link 
       valid_lft forever preferred_lft forever

Submit the job spec below

Expected Result

Nomad deploy app on port 7000 on both IP 10.0.1.249 and 10.0.1.250

Actual Result

Nomad fail to deploy with error below :

reserved port collision scylla=7000

Job file (if appropriate)

job "test-network" {
  group "fake-scylla" {
    count = 2
    network {
      port "scylla" {
        static       = 7000
        host_network = "scylla"
      }
    }

    task "server" {
      driver = "exec"

      config {
        command = "sleep"
        args = ["infinity"]
      }

      resources {
        cpu = 500 # MHz
        memory = 100 # MB
      }
    }
  }
}

Nomad Server logs (if appropriate)

Nomad Client logs (if appropriate)

@sbenoistmics
Copy link
Contributor Author

I add a pull request with tests : #23702

@sbenoistmics
Copy link
Contributor Author

@tgross Let me know if you need something else please

@gulducat
Copy link
Member

Heya @sbenoistmics, thanks for the report and PR! I'm on engineering community rotation this week, so I'll have a closer look at this sometime today or tomorrow. :)

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 Dec 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

Successfully merging a pull request may close this issue.

2 participants