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

Even if the nomad provider health check is tcp, it wants a GET method. #14861

Closed
Great-Stone opened this issue Oct 10, 2022 · 4 comments
Closed

Comments

@Great-Stone
Copy link

Nomad version

Nomad v1.4.1 (2aa7e66)

Operating system and Environment details

Linux

Issue

Even if the nomad provider health check is tcp, it wants a GET method.

Reproduction steps

service {
tags = ["api"]
port = "api"
provider = "nomad"
meta {
meta = "Api"
}
check {
type = "tcp"
port = "api"
interval = "10s"
timeout = "2s"
}
}

Expected Result

Success Health check via TCP

Actual Result

Oct 10 03:34:58 raspberrypi nomad[11410]: 2022-10-10T03:34:58.109+0100 [ERROR] http: request failed: method=GET path=/v1/client/allocation/0fbc59e0-8690-9373-1d90-4ec40517dc39/checks error="rpc: can't find method Allocations.Checks" code=500

Job file (if appropriate)

Nomad Server logs (if appropriate)

Nomad Client logs (if appropriate)

Oct 10 03:34:58 raspberrypi nomad[11410]: 2022-10-10T03:34:58.109+0100 [ERROR] http: request failed: method=GET path=/v1/client/allocation/0fbc59e0-8690-9373-1d90-4ec40517dc39/checks error="rpc: can't find method Allocations.Checks" code=500

@jrasell
Copy link
Member

jrasell commented Oct 10, 2022

Hi @Great-Stone; the client log line you have included is coming from the Nomad HTTP API and not the client internal health checking process. In particular, it is stating that something wishes to view the health checks for allocation 0fbc59e0-8690-9373-1d90-4ec40517dc39 but the client is unable to handle the request. This is potentially because this client is not running Nomad v.1.4.0 or greater, which is the version where native health checking was added. Are you able to confirm all Nomad servers and client are running v.1.4.0 or greater?

I tested locally running Nomad Nomad v1.4.1 (2aa7e66bdb526e25f59883952d74dad7ea9a014e) using nomad agent -dev and registering the following job spec:

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

  group "cache" {
    network {
      port "db" {
        to = 6379
      }
    }

    service {
      port = "db"
      provider = "nomad"
      check {
        type = "tcp"
        port = "db"
        interval = "10s"
        timeout = "2s"
      }
    }

    task "redis" {
      driver = "docker"

      config {
        image          = "redis:7"
        ports          = ["db"]
        auth_soft_fail = true
      }

      resources {
        cpu    = 500
        memory = 256
      }
    }
  }
}

The nomad alloc checks <alloc_id> command returns the expected check results:

Status of 1 Nomad Service Checks

ID         =  d35fb8338075037133b21f123c234d80
Name       =  service: "example-cache" check
Group      =  example.cache[0]
Task       =  (group)
Service    =  example-cache
Status     =  success
Mode       =  healthiness
Timestamp  =  2022-10-10T08:36:22+01:00
Output     =  nomad: tcp ok

@jrasell jrasell self-assigned this Oct 10, 2022
@jrasell jrasell added this to Needs Triage in Nomad - Community Issues Triage via automation Oct 10, 2022
@jrasell jrasell moved this from Needs Triage to Triaging in Nomad - Community Issues Triage Oct 10, 2022
@Great-Stone
Copy link
Author

Hi @jrasell, It was a mistake in my configuration. As you mentioned the version of Nomad Client was 1.3.5 as opposed to version 1.4.1 of Nomad Server. I checked this log on Nomad Server, so I thought it was server dependent. After upgrading Windows Nomad Client, it works fine.
One suggestion, if users occasionally mix versions of Nomad, it would be nice to have some logging to make sure this is because there is no new API.

Nomad - Community Issues Triage automation moved this from Triaging to Done Oct 11, 2022
@shoenig
Copy link
Member

shoenig commented Oct 11, 2022

Actually this was a bug, @Great-Stone - one that i just fixed in #14868. Nomad should have avoided placing the job on a known-to-be-outdated node (and now will in a future release). So, thanks for reporting!

@github-actions
Copy link

github-actions bot commented Feb 9, 2023

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

No branches or pull requests

3 participants