nomad
nomad copied to clipboard
Nomad Service Discovery unable to find service
Nomad version
Nomad v1.4.7
Operating system and Environment details
Debian 4.19.260-1 (2022-09-29) x86_64 GNU/Linux
Issue
Allocation is unable to find Nomad service when it exists. It seems to start happening on a client after an uptime of 2-3 days.
Reproduction steps
- Task 1: register a service
myservice
using the Nomad provider - Task 2: use template stanza and
NomadService
function to reference the service that was registered in Task 1
Able to list service:
$ nomad service list -namespace="*"
Service Name Namespace Tags
myservice default []
Expected Result
Able to discover a service consistently
Actual Result
Task log:
Template | Missing: nomad.service(myservice)
Job file (if appropriate)
Task 1:
service {
provider = "nomad"
name = "myservice"
port = "redis"
}
Task 2:
template {
data = <<EOH
{{range nomadService "myservice"}}
spring.redis.host: {{ .Address }}
spring.redis.port: {{ .Port }}
{{end}}
EOH
destination = "local/config/application.yml"
}
Nomad Client logs
2023-04-25T16:10:02.354Z [WARN] agent: (view) nomad.service(myservice): Get "http://127.0.0.1:4646/v1/service/myservice?namespace=default&stale=&wait=60000ms": closed (retry attempt 5 after "4s")
2023-04-25T16:10:06.355Z [WARN] agent: (view) nomad.service(myservice): Get "http://127.0.0.1:4646/v1/service/myservice?namespace=default&stale=&wait=60000ms": closed (retry attempt 6 after "8s")
2023-04-25T16:10:14.356Z [WARN] agent: (view) nomad.service(myservice): Get "http://127.0.0.1:4646/v1/service/myservice?namespace=default&stale=&wait=60000ms": closed (retry attempt 7 after "16s")