I'm trying to get an ultra-simple example working, but fail:
entryPoints:
hole-1:
address: :661
http:
routers:
hole-router-1:
entryPoints:
- hole-1
service: hole-service
services:
hole-service:
loadBalancer:
servers:
- url: http://10.23.24.10:3000
The configuration above when I put my browser to http://10.23.24.10:661 gives me a 404 page. I can access http://10.23.24.10:3000 directly and is working.
The documentation is horrendously poor, there are no full examples of such simple things.
1 Like
cakiwi
February 18, 2020, 12:53pm
2
You need to add a rule to your router.
Path or Host would be the easiest.
@cakiwi I tried the following now:
defaultEntryPoints:
- http
entryPoints:
hole-1:
address: ":661"
http:
routers:
hole-router-1:
rule: Path(`/foo`)
entryPoints:
- hole-1
service: hole-service
services:
hole-service:
loadBalancer:
servers:
- url: http://10.23.24.10:3000
I tried in the browser: http://10.23.24.10:661/foo
Still no luck. I still get up the 404 page not found
.
ldez
February 18, 2020, 1:30pm
4
Are you sure that the port :661
is open?
Try it locally with a curl.
Could you provide your static configuration.
cakiwi
February 18, 2020, 1:55pm
5
Getting a 404 indicates something is open on :661
+1 for static
Yea it's open, I get a completely different page (firefox default not found page) if I try for example http://10.23.24.10:662
.
I am running on Windows if that makes a difference?
I put on debug and got the following:
time="2020-02-18T15:04:51+01:00" level=info msg="Traefik version 2.1.4 built on 2020-02-06T17:12:23Z"
time="2020-02-18T15:04:51+01:00" level=debug msg="Static configuration loaded {\"global\":{\"checkNewVersion\":true},\"serversTransport\":{\"maxIdleConnsPerHost\":200},\"entryPoints\":{\"hole-1\":{\"address\":\":661\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\":10000000000},\"respondingTimeouts\":{\"idleTimeout\":180000000000}},\"forwardedHeaders\":{}}},\"providers\":{\"providersThrottleDuration\":2000000000},\"log\":{\"level\":\"DEBUG\",\"format\":\"common\"}}"
time="2020-02-18T15:04:51+01:00" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/v2.0/contributing/data-collection/\n"
time="2020-02-18T15:04:51+01:00" level=debug msg="Start TCP Server" entryPointName=hole-1
time="2020-02-18T15:04:51+01:00" level=info msg="Starting provider aggregator.ProviderAggregator {}"
time="2020-02-18T15:04:51+01:00" level=info msg="Starting provider *traefik.Provider {}"
time="2020-02-18T15:04:51+01:00" level=debug msg="Configuration received from provider internal: {\"http\":{},\"tcp\":{},\"tls\":{}}" providerName=internal
time="2020-02-18T15:04:51+01:00" level=debug msg="No default certificate, generating one"
Don't if that says anything useful.
ldez
February 18, 2020, 2:18pm
9
After re-reading your post:
You mixed the dynamic configuration and the static configuration .
They must be defined in separated files:
traefik.yml
entryPoints:
hole-1:
address: :661
providers:
file:
directory: /path/to/dynamic/conf/
/path/to/dynamic/conf/mydynconf.yml
http:
routers:
hole-router-1:
rule: Path(`/foo`)
entryPoints:
- hole-1
service: hole-service
services:
hole-service:
loadBalancer:
servers:
- url: http://10.23.24.10:3000
You also have an indentation issue.
https://docs.traefik.io/v2.1/providers/file/#configuration-examples
Ah thank you Idez for pointing that out, now it's working. There were a couple of things wrong with my config.
Path was missing (as you pointed out)
Static and Dynamic configurations must be split and referenced
I must say, the error messages were not the best and the documentation is not simple to understand that this is how the files must be structured. In any case I got it working with the following setup:
C:\config\traefik\traefik.yaml
:
entryPoints:
hole-1:
address: ":661"
providers:
file:
filename: C:\config\traefik\dynamic.yaml
C:\config\traefik\dynamic.yaml
:
http:
routers:
hole-router-1:
rule: "Path(`/`)"
entryPoints:
- hole-1
service: hole-service
services:
hole-service:
loadBalancer:
servers:
- url: http://10.23.24.10:3000
Started traefik with: traefik.exe --configFile=C:/config/traefik/traefik.yaml
2 Likes
Very glad to find this question and answer. I have to echo @basickarl about the documentation — quite frankly, it is woeful. It approaches everything from a low level, the English is somewhat awkward, there's a distinct lack of self-contained examples, and some of the examples that do exist are for Traefik v1, without any sign-posting. I say this all in the hope something will be done for other newcomers like us.