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

Updating service in consul is not working #9763

Closed
SeaLife opened this issue Jan 9, 2021 · 5 comments
Closed

Updating service in consul is not working #9763

SeaLife opened this issue Jan 9, 2021 · 5 comments

Comments

@SeaLife
Copy link

SeaLife commented Jan 9, 2021

Hey guys,

my nomad cluster is not updating the service in consul correctly.

I found a similar issue here: #9358.

The problem is probably, that the labels for my ports are not found, but as far as i know, i created my nomad job file correctly:

job "traefik" {
  datacenters = [ "dc1" ]

  type = "system"

  group "container" {
    count = 1

    update {
      max_parallel = 1
      min_healthy_time = "30s"
      healthy_deadline = "5m"

      auto_revert = true
    }

    network {
      port "http" {
        to = 80
        static = 80
      }
    }

    restart {
      attempts = 5
      delay = "15s"
    }

    task "container" {
      driver = "docker"

      service {
        name = "traefik"
        port = "http"

        tags = [ "traefik.enabled=true" ]

        meta {
          type = "lb"
        }
      }

      config {
        image = "traefik"

        ports = ["http"]
      }

      env {
        TRAEFIK_API = "true"
        TRAEFIK_API_INSECURE = "true"

        TRAEFIK_ENTRYPOINTS_HTTP    = ":80"
        TRAEFIK_ENTRYPOINTS_TRAEFIK = ":8080"

        TRAEFIK_PROVIDERS_CONSULCATALOG = "true"
        TRAEFIK_PROVIDERS_CONSULCATALOG_ENDPOINT_ADDRESS = "${attr.unique.network.ip-address}:8500"
      }

      resources {
        cpu    = 200
        memory = 64
      }

    }
  }
}

Log output:

2021-01-09T12:54:06.418Z [ERROR] client.alloc_runner.task_runner: update hook failed: alloc_id=b0456987-b8d1-0d38-f3e8-15c6d99f32ea task=container name=consul_services error="unable to get address for service "traefik": invalid port "http": port label not found"

I've defined the port with the label "http" and im using this label in the service stanza, but still, its not working 🤔

Version Outputs:

root@raspberrypi4:~/jobs# consul -v
Consul v1.9.1
Revision ca5c38943
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
root@raspberrypi4:~/jobs# nomad -v
Nomad v1.0.1 (c9c68aa55a7275f22d2338f2df53e67ebfcb9238)

Regards
SeaLife

@tgross
Copy link
Member

tgross commented Jan 11, 2021

Hi @SeaLife! I suspect this is another case of #9360 and #9735, which was fixed in #9736. I'm going to tag in my colleague @drewbailey who authored that PR to verify that. If so, the fix for this will ship in Nomad 1.0.2

@drewbailey
Copy link
Contributor

Hey @SeaLife, @tgross is correct, this was fixed in #9736.

In the mean time, you can temporarily avoid the problem by including something like an environment variable change to force the scheduler to not update the allocations in place.

@SeaLife
Copy link
Author

SeaLife commented Jan 11, 2021

Hey! Thanks for helping me out! :)
Is there a due-date for 1.0.2 or a nightly-build or something like that i can use?

Regards
SeaLife

@tgross
Copy link
Member

tgross commented Jan 11, 2021

We don't have a Nomad 1.0.2 date set. We don't currently ship nightly builds (although I think it's been discussed) but with a golang 1.15 environment set up you can build via:

make deps
make generate-all
make dev

and get the same build we use in our nightly E2E testing.

@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 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants