具有以下作业配置。curl NOMAD_IP_http:NOMAD_PORT_http
无法访问 http-echo 服务。
本地主机上没有用于传入请求的侦听端口。
为什么以及如何访问 http-echo 服务
job "job" {
datacenters = ["dc1"]
group "group" {
count = 2
network {
port "http" {}
}
service {
name = "http-echo"
port = "http"
tags = [
"http-echo",
]
check {
type = "http"
path = "/health"
interval = "30s"
timeout = "2s"
}
}
task "task" {
driver = "docker"
config {
image = "hashicorp/http-echo:latest"
args = [
"-listen", ":${NOMAD_PORT_http}",
"-text", "Hello and welcome to ${NOMAD_IP_http} running on port ${NOMAD_PORT_http}",
]
}
resources {}
}
}
}
更新
配置驱动网络模式后,卷曲成功。
network_mode = "host"