Hi,
I'm using these tools: Docker, Nomad, Consul and Traefik (2.x) and I stumble on a issue.
Traefik is currently running via docker-compose, Consul and Nomad are running as installed packages/daemons on the (single) host. DNS-resolution is fine, Traefik is serving on port 80.
I'm now choosing Sonatype Nexus as an example.
My Nomad-Job starts with this:
job "nexus" {
datacenters = ["mydatacenter"]
type = "service"
group "nexus" {
count = 1
network {
port "http" { to = 8081 }
}
...
This will result in something like:
# docker ps
89492e0801fb sonatype/nexus3 ... 192.168.1.30:27091->8081/tcp, 192.168.178.30:27091->8081/udp
The service is healthy in Consul and is registered there with port 27091
which is completely fine for me.
The interesting thing is only, that Traefik (2.3.7 and 2.4.x) detect port 8081
and try to forward requests.
My Nomad-tags are looking like this:
tags = [
"traefik.enable=true",
"traefik.http.routers.nexus.entrypoints=http",
"traefik.http.routers.nexus.rule=Host(`nexus`)",
"traefik.http.routers.nexus.service=nexus",
"traefik.http.routers.nexus2.entrypoints=http",
"traefik.http.routers.nexus2.rule=Host(`nexus.service.consul.example.com`)",
"traefik.http.routers.nexus2.service=nexus",
"traefik.http.services.nexus.loadbalancer.server.port=${NOMAD_PORT_http}",
]
Which usually works fine, at least this pushes the correct information to Consul.
BUT: Traefik tries to route requests to the wrong port (in my understanding).
I currently only can use Traefik as a proxy when I choose this Nomad-Job:
```hcl
job "nexus" {
datacenters = ["mydatacenter"]
type = "service"
group "nexus" {
count = 1
network {
port "http" { strict = 8081 }
}
...
which then results in
# docker ps
89492e0801fb sonatype/nexus3 ... 192.168.1.30:8081->8081/tcp, 192.168.178.30:8081->8081/udp
but this isn't what I really want.
Can you help me spotting the configuration issue?
My traefik.yml
is this:
api:
dashboard: true
insecure: true
entryPoints:
http:
address: ":80"
forwardedHeaders:
insecure: true
providers:
consulCatalog:
prefix: "traefik"
exposedByDefault: false
endpoint:
address: "192.168.1.30:8500"
scheme: "http"
Disclaimer: This is currently only a lab-environment.