Traefik 2.0闸道超时

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Traefik 2.0闸道超时相关的知识,希望对你有一定的参考价值。

仅通过http创建了具有2个服务的简单Traefik实例。我在两个实例中都收到网关超时,这是我创建服务和traefik代理的唯一文件。

version: '3.4'

services:
  reverse-proxy:
    image: traefik:2.0 # The official Traefik docker image
    ports:
      - "80:80"     # The HTTP port
      - "10553:8080"    # The Web UI (enabled by --api)
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
    networks:
      - default
    command:
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.network=demo_swarm_network"
      - "--providers.docker.exposedbydefault=false"      
      - "--providers.docker.swarmMode=true"
      - "--entrypoints.web.address=:80"
    deploy:
      mode: global
      placement:
        constraints:
          - node.role == manager
      update_config:
        parallelism: 1
        delay: 10s
      restart_policy:
        condition: on-failure  
  xxxxx-authentication-api:
    image: xxxx_authentication_api_nightly:9999
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.docker.lbswarm=true"
        - "traefik.docker.network=demo_swarm_network"
        - "traefik.http.routers.authenticationapi.rule=PathPrefix(`/api/authentication`)"
        - "traefik.http.routers.authenticationapi.entrypoints=web"        
        - "traefik.http.services.xxxxx-authentication-api.loadbalancer.server.port=3000"
        - "traefik.http.services.xxxxx-authentication-api.loadbalancer.server.scheme=http"
      replicas: 1
      update_config:
        parallelism: 1
        delay: 10s
        order: stop-first
    command: node ./server.js
    environment:
      - NODE_ENV=authentication 
      - LOG_LEVEL=info 
      - NODE_CONFIG_DIR=./config
    networks:
      - default
    ports:
      - "3000"
  xxxxx-authentication-app:
    image: xxxxx_authentication_app_nightly:9999
    deploy:
      labels:
        - "traefik.enable=true"       
        - "traefik.docker.lbswarm=true"
        - "traefik.docker.network=demo_swarm_network"
        - "traefik.http.routers.authenticationapp.rule=PathPrefix(`/authentication`)"    
        - "traefik.http.routers.authenticationapp.entrypoints=web"
        - "traefik.http.services.xxxxx-authentication-app.loadbalancer.server.port=80"
        - "traefik.http.services.xxxxx-authentication-app.loadbalancer.server.scheme=http"
      replicas: 1
      update_config:
        parallelism: 1
        delay: 10s
        order: stop-first
    networks:
      - default
    ports:
      - "80"
networks:
  default:
    external:
      name: demo_swarm_network

服务已启动并正在运行,容器也已启动。 Traefik也正在运行,正当我尝试localhost:80/api/authenticationlocalhost:80/authentication时,我会收到网关超时。

traefik在哪里发送我的请求?我已在主机端口中确认两个端点中的应用程序正在运行。

我的配置中缺少什么?

答案

Huzzah!当我将demo_swarm_network网络更新为overlay时,超时消失了。

以上是关于Traefik 2.0闸道超时的主要内容,如果未能解决你的问题,请参考以下文章

Traefik 2.0+ TCP 和 postgres

如何使用 Traefik 2.0 和 Docker Compose 标签将 http 重定向到 https?

将Traefik StripPrefix中间件添加到docker-compose标签结果为504

测试片段不执行定时器或示例超时

OAuth 2.0应该用于身份验证超时吗?

Linkedin OAuth 2.0 重定向 URL 不能包含片段标识符 (#)