Hello all:
My environment:
Nomad v1.9.0
Consul v1.20.0
Traefik v3.2.0
I have a 3-node cluster running Nomad, Consul, and Vault.
I am attempting to use Traefik to load balance the Nomad UI (and eventually will do the same for Consul/Vault).
I am leveraging the Consul catalog so that Traefik can auto-discover the correct routes.
Here is what my Traefik job looks like:
job "traefik" {
datacenters = ["homelab"]
type = "service"
group "traefik" {
network {
port "http" {
static = 80
}
port "https" {
static = 443
}
}
service {
name = "traefik"
port = "https"
tags = [
"traefik.enable=true",
"traefik.http.routers.dashboard.rule=Host(`traefik.fqdn`)",
"traefik.http.routers.dashboard.service=api@internal",
"traefik.http.routers.dashboard.entrypoints=web,websecure",
"traefik.http.routers.dashboard.tls.certresolver=internal",
"traefik.http.routers.dashboard.tls=true",
]
check {
name = "alive"
type = "tcp"
port = "http"
interval = "10s"
timeout = "2s"
}
}
service {
name = "nomad"
port = "https"
tags = [
"traefik.enable=true",
"traefik.http.routers.nomad.rule=Host(`nomad.fqdn`)",
"traefik.http.routers.nomad.service=nomad",
"traefik.http.routers.nomad.entrypoints=web,websecure",
"traefik.http.routers.nomad.tls.certresolver=internal",
"traefik.http.routers.nomad.tls=true",
"traefik.http.services.nomad.loadbalancer.server.port=4646",
]
}
task "traefik" {
driver = "podman"
config {
image = "docker.io/library/traefik:v3.2.0"
ports = [
"http",
"https",
]
args = [
"--api.dashboard=true",
"--log.level=DEBUG",
"--accesslog=true",
# Consul integration
"--providers.consulcatalog=true",
"--providers.consulcatalog.exposedByDefault=false",
"--providers.consulcatalog.prefix=traefik",
"--providers.consulcatalog.endpoint.address=${NOMAD_IP_http}:8500",
# HTTP entrypoints
"--entrypoints.web.address=:${NOMAD_PORT_http}",
"--entrypoints.websecure.address=:${NOMAD_PORT_https}",
# Internal ACME/PKI
"--certificatesresolvers.internal.acme.caserver=https://ca.fqdn/acme/acme/directory",
"--certificatesresolvers.internal.acme.email=me@fqdn",
"--certificatesresolvers.internal.acme.storage=/local/internal.acme.json",
"--certificatesresolvers.internal.acme.tlschallenge=true",
"--certificatesresolvers.internal.acme.certificatesduration=24",
# Non-HTTP entrypoints
]
}
artifact {
source = "https://ca.fqdn/roots.pem"
mode = "file"
}
env {
LEGO_CA_CERTIFICATES = "/local/roots.pem"
}
resources {
cpu = 100
memory = 128
}
}
}
}
When I curl to http://nomad.fqdn, I get a 404 error.
The Nomad entry in Traefik’s dashboard appears correct to me, and I am not sure what the issue could be.
Is anyone doing something similar with success? Any insight would be appreciated.
Thank you