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

[question] service stanza inside task cannot find port labels #9381

Closed
m1keil opened this issue Nov 17, 2020 · 3 comments
Closed

[question] service stanza inside task cannot find port labels #9381

m1keil opened this issue Nov 17, 2020 · 3 comments

Comments

@m1keil
Copy link

m1keil commented Nov 17, 2020

I'm having issues making this trivial config to execute:

(Nomad 0.12.7)

job "example" {
  datacenters = ["dc1"]
  group "webGroup" {
    network {
      port "http" { to = 80 }
    }
    task "webTask" {
      driver = "docker"
      config {
        image = "nginxdemos/hello"
        ports = ["http"]
      }
      service {
        port = "http"
        check {
          type     = "tcp"
          interval = "10s"
          timeout  = "2s"
          port     = "http"
        }
      }
      resources {
        cpu    = 500
        memory = 256
      }
    }
  }
}

Getting back:

Error submitting job: Unexpected response code: 500 (1 error occurred:
	* Task group webGroup validation failed: 1 error occurred:
	* Task webTask validation failed: 1 error occurred:
	* 1 error occurred:
	* port label "http" referenced by services example-webGroup-webTask does not exist

After fiddling around with it I realized that moving the service stanza up into the task group does the trick.
I can't understand or find the relevant reference in the docs to why this doesn't work in the first place. This doc seems to have exact same config.

@apollo13
Copy link
Contributor

This seems to be a duplicate of #8780

@m1keil
Copy link
Author

m1keil commented Nov 19, 2020

It is indeed. Thank you.

@m1keil m1keil closed this as completed Nov 19, 2020
@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 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants