traefik找不到前端和后端

时间:2018-11-07 16:42:54

标签: traefik

我通过此命令(使用docker)运行traefik:

docker run -d -p 8080:8080 -p 80:80 -p 443:443 -v ~/playground/docker/traefik/traefik.toml:/etc/traefik/traefik.toml -v /var/run/docker.sock:/var/run/docker.sock traefik:1.7.4-alpine

并将此配置放在traefik.toml上:

debug = true
logLevel = "DEBUG"
[entryPoints]
    [entryPoints.http]
    address = ":80"

[file]
    watch = true

[backends]
    [backends.backend1]
        [backends.backend1.servers.server1]
        url = "http://172.17.0.1:5000"
        weight = 0

[frontends]
    [frontends.frontend1]
        backend = "backend1"
            [frontends.frontend1.routes.test_1]
            rule = "Host:linker.test"

[api]

[ping]

[docker]

当我查看traefik仪表板时,没有 frontend1 backend1 !我是根据traefik的文档进行此配置的,我无法弄清发生了什么!

为什么无法检测到我的 frontend1 backend1 ?我怎么了?

这是容器日志:

time="2018-11-08T12:22:50Z" level=info msg="I have to go..."
time="2018-11-08T12:22:50Z" level=info msg="Stopping server gracefully"
time="2018-11-08T12:22:50Z" level=debug msg="Waiting 10s seconds before killing connections on entrypoint traefik..."
time="2018-11-08T12:22:50Z" level=debug msg="Waiting 10s seconds before killing connections on entrypoint http..."
time="2018-11-08T12:22:50Z" level=debug msg="Entrypoint traefik closed"
time="2018-11-08T12:22:50Z" level=debug msg="Entrypoint http closed"
time="2018-11-08T12:22:50Z" level=info msg="Server stopped"
time="2018-11-08T12:22:50Z" level=info msg="Shutting down"
time="2018-11-08T12:22:51Z" level=info msg="Using TOML configuration file /etc/traefik/traefik.toml"
time="2018-11-08T12:22:51Z" level=info msg="Traefik version v1.7.4 built on 2018-10-30_10:44:30AM"
time="2018-11-08T12:22:51Z" level=debug msg="Global configuration loaded {\"LifeCycle\":{\"RequestAcceptGraceTimeout\":0,\"GraceTimeOut\":10000000000},\"GraceTimeOut\":0,\"Debug\":true,\"CheckNewVersion\":true,\"SendAnonymousUsage\":false,\"AccessLogsFile\":\"\",\"AccessLog\":null,\"TraefikLogsFile\":\"\",\"TraefikLog\":null,\"Tracing\":null,\"LogLevel\":\"DEBUG\",\"EntryPoints\":{\"http\":{\"Address\":\":80\",\"TLS\":null,\"Redirect\":null,\"Auth\":null,\"WhitelistSourceRange\":null,\"WhiteList\":null,\"Compress\":false,\"ProxyProtocol\":null,\"ForwardedHeaders\":{\"Insecure\":true,\"TrustedIPs\":null}},\"traefik\":{\"Address\":\":8080\",\"TLS\":null,\"Redirect\":null,\"Auth\":null,\"WhitelistSourceRange\":null,\"WhiteList\":null,\"Compress\":false,\"ProxyProtocol\":null,\"ForwardedHeaders\":{\"Insecure\":true,\"TrustedIPs\":null}}},\"Cluster\":null,\"Constraints\":[],\"ACME\":null,\"DefaultEntryPoints\":[\"http\"],\"ProvidersThrottleDuration\":2000000000,\"MaxIdleConnsPerHost\":200,\"IdleTimeout\":0,\"InsecureSkipVerify\":false,\"RootCAs\":null,\"Retry\":null,\"HealthCheck\":{\"Interval\":30000000000},\"RespondingTimeouts\":null,\"ForwardingTimeouts\":null,\"AllowMinWeightZero\":false,\"KeepTrailingSlash\":false,\"Web\":null,\"Docker\":{\"Watch\":true,\"Filename\":\"\",\"Constraints\":null,\"Trace\":false,\"TemplateVersion\":2,\"DebugLogGeneratedTemplate\":false,\"Endpoint\":\"unix:///var/run/docker.sock\",\"Domain\":\"\",\"TLS\":null,\"ExposedByDefault\":true,\"UseBindPortIP\":false,\"SwarmMode\":false,\"Network\":\"\"},\"File\":{\"Watch\":true,\"Filename\":\"\",\"Constraints\":null,\"Trace\":false,\"TemplateVersion\":0,\"DebugLogGeneratedTemplate\":false,\"Directory\":\"\",\"TraefikFile\":\"/etc/traefik/traefik.toml\"},\"Marathon\":null,\"Consul\":null,\"ConsulCatalog\":null,\"Etcd\":null,\"Zookeeper\":null,\"Boltdb\":null,\"Kubernetes\":null,\"Mesos\":null,\"Eureka\":null,\"ECS\":null,\"Rancher\":null,\"DynamoDB\":null,\"ServiceFabric\":null,\"Rest\":null,\"API\":{\"EntryPoint\":\"traefik\",\"Dashboard\":true,\"Debug\":true,\"CurrentConfigurations\":null,\"Statistics\":null},\"Metrics\":null,\"Ping\":{\"EntryPoint\":\"traefik\"},\"HostResolver\":null}"
time="2018-11-08T12:22:51Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/basics/#collected-data\n"
time="2018-11-08T12:22:51Z" level=info msg="Preparing server http &{Address::80 TLS:<nil> Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc0003cbd40} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
time="2018-11-08T12:22:51Z" level=info msg="Preparing server traefik &{Address::8080 TLS:<nil> Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc0003cbd60} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
time="2018-11-08T12:22:51Z" level=info msg="Starting provider configuration.ProviderAggregator {}"
time="2018-11-08T12:22:51Z" level=info msg="Starting server on :80"
time="2018-11-08T12:22:51Z" level=info msg="Starting server on :8080"
time="2018-11-08T12:22:51Z" level=info msg="Starting provider *docker.Provider {\"Watch\":true,\"Filename\":\"\",\"Constraints\":null,\"Trace\":false,\"TemplateVersion\":2,\"DebugLogGeneratedTemplate\":false,\"Endpoint\":\"unix:///var/run/docker.sock\",\"Domain\":\"\",\"TLS\":null,\"ExposedByDefault\":true,\"UseBindPortIP\":false,\"SwarmMode\":false,\"Network\":\"\"}"
time="2018-11-08T12:22:51Z" level=info msg="Starting provider *file.Provider {\"Watch\":true,\"Filename\":\"\",\"Constraints\":null,\"Trace\":false,\"TemplateVersion\":0,\"DebugLogGeneratedTemplate\":false,\"Directory\":\"\",\"TraefikFile\":\"/etc/traefik/traefik.toml\"}"
time="2018-11-08T12:22:51Z" level=debug msg="Configuration received from provider file: {\"backends\":{\"backend1\":{\"servers\":{\"server1\":{\"url\":\"http://172.17.0.1:5000\",\"weight\":0}},\"circuitBreaker\":{\"expression\":\"NetworkErrorRatio() \\u003e 0.5\"}}}}"
time="2018-11-08T12:22:51Z" level=info msg="Server configuration reloaded on :80"
time="2018-11-08T12:22:51Z" level=info msg="Server configuration reloaded on :8080"
time="2018-11-08T12:22:51Z" level=debug msg="Provider connection established with docker 18.09.0 (API 1.39)"
time="2018-11-08T12:22:51Z" level=debug msg="originLabelsmap[org.label-schema.version:v1.7.4 org.label-schema.description:A modern reverse-proxy org.label-schema.docker.schema-version:1.0 org.label-schema.name:Traefik org.label-schema.url:https://traefik.io org.label-schema.vendor:Containous]"
time="2018-11-08T12:22:51Z" level=debug msg="allLabelsmap[:map[]]"
time="2018-11-08T12:22:51Z" level=debug msg="Filtering container with empty frontend rule /kind_leavitt "
time="2018-11-08T12:22:51Z" level=debug msg="originLabelsmap[com.sonatype.license:Apache License, Version 2.0 com.sonatype.name:Nexus Repository Manager base image org.label-schema.schema-version:= 1.0     org.label-schema.name=CentOS Base Image     org.label-schema.vendor=CentOS     org.label-schema.license=GPLv2     org.label-schema.build-date=20180531 vendor:Sonatype]"
time="2018-11-08T12:22:51Z" level=debug msg="allLabelsmap[:map[]]"
time="2018-11-08T12:22:51Z" level=debug msg="Filtering container with empty frontend rule /nexus "
time="2018-11-08T12:22:51Z" level=debug msg="originLabelsmap[]"
time="2018-11-08T12:22:51Z" level=debug msg="allLabelsmap[:map[]]"
time="2018-11-08T12:22:51Z" level=debug msg="Filtering container with empty frontend rule /personal-postgres "
time="2018-11-08T12:22:51Z" level=debug msg="originLabelsmap[]"
time="2018-11-08T12:22:51Z" level=debug msg="allLabelsmap[:map[]]"
time="2018-11-08T12:22:51Z" level=debug msg="Filtering container with empty frontend rule /portainer "
time="2018-11-08T12:22:51Z" level=debug msg="Configuration received from provider docker: {}"
time="2018-11-08T12:22:51Z" level=info msg="Server configuration reloaded on :80"
time="2018-11-08T12:22:51Z" level=info msg="Server configuration reloaded on :8080"

解决方案是@Marvin聊天

  • 尝试同时删除[ping]和[docker]:出于测试目的, 您不需要它们atm
  • 从以下位置删除“ watch = true” [file]节点,因为该节点将监视预期的现有节点 文件,而不是
  • 检查您的docker版本,并在需要时进行更新
  • 删除“ weight = 0”,因为只有一个后端,而且我 不确定'0'是有效值

当我删除[ping]和[docker]时,一切正常!

0 个答案:

没有答案