Traefik 2 如何在静态配置中引用 tls 证书以在 docker-compose 文件中进行路由

Traefik 2 how to refer tls certificates inside static config for routing inside docker-compose files

我已经在 traefik_v2.yml

中定义了一个静态配置
api: 
  dashboard: true
  insecure: true
global: {}
providers:
  providersThrottleDuration: 2s
  docker:
    watch: true
    endpoint: unix:///var/run/docker.sock
    swarmModeRefreshSeconds: 15s
  file:
    filename: "traefik_v2.yml"
log:
  level: INFO
tls:
  certificates:
    - certFile: /run/secrets/cert_secret
      keyFile: /run/secrets/cert_key_secret
entryPoints:
  web:
    address: ":80"
    redirections:
      entrypoint:
        to: external
        scheme: https
  web-secure:
    address: ":443"
  api:
    address: ":8080"
  external:
    address: ":10443"

现在,在我的一个撰写文件中,如何将路由器 tls 配置配置为静态文件 traefik_v2.yml 中存在的配置?

    version: '3.4'

    services:

      x-authentication-app:
        image: x_authentication_app_nightly:v${BUILD_NUMBER}
        deploy:
          labels:
            - "traefik.docker.network=x-swarm-net"
            - "traefik.http.routers.authenticationapp.rule=PathPrefix(`/authentication`)"    
            - "traefik.http.routers.authenticationapp.service=x-authentication-app"    
            - "traefik.http.routers.authenticationapp.entrypoints=web"   
            - "traefik.http.routers.authenticationapp.tls={}" // **What to say in here ? I want to use the static configurations that I created for tls in the traefik_v2.yml**
            - "traefik.enable=true"
            - "traefik.port=80"
          replicas: 1
          update_config:
            parallelism: 1
            delay: 10s
            order: stop-first
        networks:
          - default

    networks:
      default:
        external:
          name: x-swarm-net

您无需多说,只需设置 traefik.http.routers.authenticationapp.tls=true

您还需要让端点侦听端口 443:

traefik.http.routers.authenticationapp.entrypoints=web, web-secure