Based on multiple providers with the same rule · Issue #9599 · traefik/traefik · GitHub I am reposting the question here for further discussion.
I'll try to explain what I have done so far and my further confusion.
What I have:
-
Traefik Proxy v 2.9.6 (also tried with 3.0.0-beta2)
-
a standalone EC2 with Trafik Proxy running on it, in the same VPC as that of the ECS cluster, and he standalone EC2 is part of the Nomad cluster.
-
an ECS service (of a simple web server for now) which desired count == 2.
the message this services echoes in the HTML isHELLO FROM ECS
.
the ECS deployment is successful with two containers running. -
a Nomad service which runs the same "simple web server", but with a different HTML message;
HELLO FROM NOMAD
.
the Nomad service is successful with two containers running.
What I want to do:
- clients will connect to the Traefik Proxy machine, and I want the ECS and Nomad backends to be served with equal weightage (approximate equal will also do)
What is happening:
When I start both the ECS and Nomad services, Traefik routes all HTTP requests to a single backend, the Nomad ones.
If I stop the Nomad services, then the ECS backends start to be served.
- The Traefik Proxy's config files are as follows:
Static Configuration:
## Static configuration; traefik.yaml
global:
checkNewVersion: false
sendAnonymousUsage: false
entryPoints:
web:
address: :80
websecure:
address: :443
traefik:
address: :8080
api:
insecure: true
dashboard: true
pilot:
dashboard: false
log:
level: DEBUG
accessLog:
format: common
providers:
ecs:
exposedByDefault: false
autoDiscoverClusters: false
clusters:
- myecsclustername
region: 'my-aws-region'
ecsAnywhere: false
consulCatalog:
exposedByDefault: false
nomad:
exposedByDefault: false
file:
filename: dynamic_config.yaml
Dynamic Configuration:
## Dynamic configuration; dynamic_config.yaml
http:
services:
app:
weighted:
services:
- name: service-web-scratch-ecs-web-scratch-ecs
weight: 1
- name: web-scratch-nomad
weight: 1
ECS Details:
- ECS service name:
web-scratch-ecs
- container definition name:
web-scratch-ecs
- part of container definition:
dockerLabels = {
"traefik.enable" : "true",
"traefik.http.routers.myproxy.rule": "Path(`/hello`)",
"traefik.http.routers.myproxy.priority": "1",
}
Nomad Details:
- Nomad service definition:
service {
provider = "nomad" # I have even tried using the `consul` provider to see if that changes anything.
name = "web-scratch-nomad"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.myproxy.rule=Path(`/hello`)",
"traefik.http.routers.myproxy.priority=1",
]
check {
name = "health"
type = "http"
path = "/"
interval = "30s"
timeout = "10s"
}
} # service
Note: the above configs are slightly updated since the original GitHub issue, but still not working as expected
Based on GitHub issue and the following comment multiple providers with the same rule · Issue #9599 · traefik/traefik · GitHub I have many questions
-
I am confused by "global router", how to do that? Any example?
-
Also, in the issue @ldez mentioned "services without routers", but I am completely lost as to how to do that, all examples have a
router
as part of the examples.
At this moment, I am going round in circles, and I am now sure I am doing something fundamentally wrong in the static+dynamic config wrong to begin with.
Also, I have started to wonder if what I am asking is doable in a completely label based method using dynamic configuration.
My backends are dynamic, potentially scaling up and down from time to time, so using fixed url backend is not possible!
Do let me know if any more information is needed about the setup.
Regards,
Shantanu Gadgil