Constraint "${attr.consul.version} semver >= 1.8.0"

2 Likes

Hi @aliegrsp,

The error indicates Nomad is not correctly fingerprinting Consul or that it cannot find the Consul API. Do you have any logs available from the Nomad agent?

Thanks,
jrasell and the Nomad team

Hey @jrasell ,

I have the same error, but I’m not using Consul. My setup is very simpl/straightforward I know Nomad server IP address beforehand:


cat /etc/nomad.d/nomad.hcl
data_dir = "/var/nomad"
bind_addr = "0.0.0.0"

# Enable the client
client {
  enabled = true
  servers = ["192.168.100.254"]
}

# Disable the server
server {
  enabled = false
}

# Match the datacenter and region of the server
datacenter = "dc1"
region = "global"

I have the same error, and I’m not using Consul also.

For future, if anyone is having this issue, just add provider to service:

service {
     provider = "nomad"
     ...
}
3 Likes

I’m having a very similar issue. I’m trying avoid installing/utilizing consul at this stage of development and running a pure-nomad environment.

Where does this block go? Job definition? Client definition? Server definition?

service {
     provider = "nomad"
     ...
}
1 Like

Hey @will this would go into your job definition:

job "name" {
    group "name" {
        service {
            ...
            provider = "nomad"

thing is, if you’re using consul for service-discovery, this service won’t be discoverable that way IIUC.

I think this service block can also be in the task block if you have it.

I was curious about the service.provider and llm described it as:

In Nomad, the provider block within a service definition allows you to specify which service discovery provider Nomad should use to register the service with. The provider defines the service registration mechanism for the service, and by default, it will use the appropriate service discovery backend based on your Nomad setup.

The provider block:

  • provider specifies which service discovery system to use.

  • For Nomad, this can be either Consul or Nomad’s internal service discovery system .

    Example:

    service {
      name = "my-service"
      port = "8080"
    
      provider = "nomad"  # Specifies that Nomad's internal service discovery should be used.
    
      check {
        type     = "http"
        path     = "/health"
        interval = "30s"
        timeout  = "5s"
      }
    }
    

In this example, provider = "nomad" tells Nomad to register the service with Nomad’s own service discovery system. If you wanted to use Consul as the service discovery system instead, you would set provider = "consul".

Default behavior:

  • If you do not specify the provider block, Nomad will default to Consul for service discovery if Consul is integrated into your Nomad setup (which is the most common setup).
  • In other words, if Consul is available, Nomad will automatically use it as the provider to register the service.

Key points to remember:

  • provider = "nomad" uses Nomad’s built-in service discovery system.
  • provider = "consul" uses Consul for service discovery and registration.
  • The provider is useful when you want to explicitly control or override which service discovery system Nomad should use for a specific service.

In short, the provider block specifies which service registry (Consul or Nomad’s internal registry) should be used to register and manage the service’s lifecycle. If you don’t provide it explicitly, Nomad will default to using Consul if Consul is enabled in the environment.

I did find this as well:

1 Like