I have a simple configuration that launches two tasks, on redis and one httpd; both are bare bones setups.
I’m trying to find the correct way to have the httpd task be able to connect to the redis port of the redis task. After starting the job and running nomad alloc exec into the httpd task the machine is unaware of how to find the redis task.
What is the nomad way to have tasks aware of other tasks?
Here is my dns-example.nomad:
job "dns-example" {
region = "global"
datacenters = ["dc1"]
type = "service"
group "services" {
count = 1
network {
mode = "host"
port "https" {}
port "http" {}
port "redis" {
static = 6379
}
}
task "redis" {
driver = "docker"
config {
image = "redis:6.2.1-alpine3.13"
ports = ["redis"]
force_pull = false
args = ["redis-server"]
}
}
task "httpd" {
driver = "docker"
config {
image = "httpd:2.4-alpine"
ports = ["http", "https"]
force_pull = false
}
}
}
}