Skip to content

Conversation

@ebarriosjr
Copy link
Contributor

This works on the consul level but the address in nomad is still wrong.

Task "task1" is "running"
Task Resources
CPU        Memory          Disk     Addresses
0/200 MHz  16 MiB/128 MiB  300 MiB  bla: 172.20.132.250:80

Consul shows it as:
https://upload.thaller.ws/files/5b070df9f0864c19b87031a47038e66889adf794/2020-03-13_18-30-25_3480.png

The ip specified inside the job is 172.20.132.251 as shown by consul.

@ebarriosjr
Copy link
Contributor Author

@ebarriosjr
Copy link
Contributor Author


job "nginx-este" {
  datacenters = ["dc1"]
  type        = "service"

  group "group1" {
    count = 1 
    meta = {
      version = "6"
    }

    update {
      max_parallel     = 1 
      min_healthy_time = "10s"
      healthy_deadline = "8m"
      auto_revert      = true
    }

    task "task1" {
      driver = "pot"

      service {
        tags = ["net-jail", "trv-metrics"]
        name = "pot-webserver"
        port = "bla" 
        address_mode="driver"

         check {
            address_mode="driver"
            type     = "tcp"
            port     = "bla"
            name     = "tcp"
            interval = "5s"
            timeout  = "2s"
          }
      }

      config {
        image = "https://pot.pizzamig.dev/registry/"
        pot = "FBSD120-nginx"
        tag = "1.0"
        command = "nginx"
        args = [ 
          " -g 'daemon off;'"
        ]

        port_map = {
          bla = "80"
        }

        network_mode = "alias"
        ip = "172.20.132.251"
      }

      resources {
        cpu = 200
        memory = 128

        network {
          mbits = 10
          port "bla" {
            static = 80
          }
        }
      }
    }
  }
}

@ebarriosjr
Copy link
Contributor Author

This can be merge to master even though there is a bug in nomad where the nomad ui will show the wrong IP but the service will be register in consul with the IP from the alias. @pizzamig any thoughts on this?

@pizzamig
Copy link
Contributor

it can land in master, and I would open an issue to document the bug

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants