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

Example job created with nomad job init fails to allocate. #13136

Closed
tomasz-kuzemko opened this issue May 26, 2022 · 2 comments
Closed

Example job created with nomad job init fails to allocate. #13136

tomasz-kuzemko opened this issue May 26, 2022 · 2 comments
Labels

Comments

@tomasz-kuzemko
Copy link

Nomad version

Output from nomad version

Nomad v1.3.1 (2b054e3)

Operating system and Environment details

Ubuntu 20.04

Issue

Example task created with nomad job init fails to allocate when ran with nomad job run example.nomad.

I'm new to Nomad, but it seems the issue is caused by a recent change to make consul the default value for provider field in service block. After modifying the example.nomad job to explicitly set provider = "nomad", I was able to run it properly.

Not sure if this is intentional, but I also noticed that the example job generated with nomad job init -short differs greatly (not counting the comments) than the one generated without the -short flag.

Reproduction steps

$ nomad job init
Example job file written to example.nomad
$ nomad job run example.nomad 
==> 2022-05-26T17:24:40+02:00: Monitoring evaluation "d28e1bdd"
    2022-05-26T17:24:40+02:00: Evaluation triggered by job "example"
==> 2022-05-26T17:24:41+02:00: Monitoring evaluation "d28e1bdd"
    2022-05-26T17:24:41+02:00: Evaluation within deployment: "fbf36089"
    2022-05-26T17:24:41+02:00: Evaluation status changed: "pending" -> "complete"
==> 2022-05-26T17:24:41+02:00: Evaluation "d28e1bdd" finished with status "complete" but failed to place all allocations:
    2022-05-26T17:24:41+02:00: Task Group "cache" (failed to place 1 allocation):
      * Constraint "${attr.consul.version} semver >= 1.7.0": 1 nodes excluded by filter
    2022-05-26T17:24:41+02:00: Evaluation "1c598735" waiting for additional capacity to place remainder
==> 2022-05-26T17:24:41+02:00: Monitoring deployment "fbf36089"
  ⠙ Deployment "fbf36089" in progress...
    
    2022-05-26T17:50:47+02:00
    ID          = fbf36089
    Job ID      = example
    Job Version = 0
    Status      = running
    Description = Deployment is running
    
    Deployed
    Task Group  Desired  Placed  Healthy  Unhealthy  Progress Deadline
    cache       1        0       0        0          N/A

Expected Result

Example Nomad job gets deployed successfully without modifications.

Actual Result

Example Nomad job fails to get deployed without setting explicit provider = "nomad" in service block.

Job file (if appropriate)

$ cat example.nomad | grep -v -E '^\s*#' | sed -e /^$/d
job "example" {
  datacenters = ["dc1"]
  type = "service"
  update {
    max_parallel = 1
    min_healthy_time = "10s"
    healthy_deadline = "3m"
    progress_deadline = "10m"
    auto_revert = false
    canary = 0
  }
  migrate {
    max_parallel = 1
    health_check = "checks"
    min_healthy_time = "10s"
    healthy_deadline = "5m"
  }
  group "cache" {
    count = 1
    network {
      port "db" {
        to = 6379
      }
    }
    service {
      name = "redis-cache"
      tags = ["global", "cache"]
      port = "db"
    }
    restart {
      attempts = 2
      interval = "30m"
      delay = "15s"
      mode = "fail"
    }
    ephemeral_disk {
      size = 300
    }
    task "redis" {
      driver = "docker"
      config {
        image = "redis:3.2"
        ports = ["db"]
      }
      resources {
        cpu    = 500 # 500 MHz
        memory = 256 # 256MB
      }
    }
  }
}

Nomad Server logs (if appropriate)

Nomad Client logs (if appropriate)

@shoenig
Copy link
Member

shoenig commented May 26, 2022

Hi @tomasz-kuzemko, thanks for the report - we actually already have a fix for this that will be going out in the next release: #13044 Like you mentioned, we meant to set provider= "nomad" and forgot 🤦

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

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

No branches or pull requests

2 participants