Traefik + Consul not generaitng SSL certificates in replicated mode, using TRAEFIK DEFAULT CERT

天大地大妈咪最大 提交于 2020-07-21 10:25:39

问题


I have a setup of 1 master and 2 worker nodes running docker swarm. I deployed Traefik + Consul using the setup below:

version: '3.3'
services:
  consul-leader:
    image: consul:latest
    command:
     - agent
     - -server
     - -client=0.0.0.0
     - -bootstrap
     - -ui
    environment:
      CONSUL_BIND_INTERFACE: eth0
      CONSUL_LOCAL_CONFIG: '{"leave_on_terminate": true}'
    volumes:
     - consul-data-leader:/consul/data
    networks:
     - default
     - traefik-public
    logging:
      driver: json-file
    deploy:
      labels:
        traefik.tags: traefik-public
        traefik.redirectorservice.frontend.redirect.entryPoint: https
        traefik.webservice.frontend.entryPoints: https
        traefik.redirectorservice.frontend.entryPoints: http
        traefik.docker.network: traefik-public
        traefik.enable: 'true'
        traefik.frontend.auth.basic.users: admin:$apr1$lKAo73kT$xlahD.KLANH8ZbMaDXDsC.
        traefik.port: '8500'
        traefik.frontend.rule: Host:consul.live.mydomain.app
  consul-replica:
    image: consul:latest
    command:
     - agent
     - -server
     - -client=0.0.0.0
     - -retry-join=consul-leader
    environment:
      CONSUL_BIND_INTERFACE: eth0
      CONSUL_LOCAL_CONFIG: '{"leave_on_terminate": true}'
    volumes:
     - consul-data-replica:/consul/data
    networks:
     - default
     - traefik-public
    logging:
      driver: json-file
    deploy:
      replicas: 3
  traefik:
    image: traefik:v1.7
    command:
     - --docker
     - --docker.swarmmode
     - --docker.watch
     - --docker.exposedbydefault=false
     - --constraints=tag==traefik-public
     - --entrypoints=Name:http Address::80
     - --entrypoints=Name:https Address::443 TLS
     - --consul
     - --consul.endpoint=consul-leader:8500
     - --acme
     - --acme.email=me.me@me.com
     - --acme.storage=traefik/acme/account
     - --acme.entryPoint=https
     - --acme.httpChallenge.entryPoint=http
     - --acme.onhostrule=true
     - --acme.acmelogging=true
     - --logLevel=INFO
     - --accessLog
     - --api
    ports:
     - 80:80
     - 443:443
    volumes:
     - /var/run/docker.sock:/var/run/docker.sock
    networks:
     - default
     - traefik-public
    logging:
      driver: json-file
    deploy:
      replicas: 3
      labels:
        traefik.tags: traefik-public
        traefik.redirectorservice.frontend.redirect.entryPoint: https
        traefik.webservice.frontend.entryPoints: https
        traefik.redirectorservice.frontend.entryPoints: http
        traefik.docker.network: traefik-public
        traefik.enable: 'true'
        traefik.frontend.auth.basic.users: admin:$apr1$lKAo73kT$xlahD.KLANH8ZbMaDXDsC.
        traefik.port: '8080'
        traefik.frontend.rule: Host:traefik.live.mydomain.app
      placement:
        constraints:
         - node.role == manager
networks:
  default:
    driver: overlay
  traefik-public:
    external: true
volumes:
  consul-data-replica:
    driver: local

When I deploy a service or stack in GLOBAL mode, everything seems to work fine. However, when I try to deploy stack using replicated mode, SSL certificate is not generated and Traefik is using TRAEFIK DEFAULT CERT instead. Can anyone tell me what I'm doing wrong ?

来源:https://stackoverflow.com/questions/60903658/traefik-consul-not-generaitng-ssl-certificates-in-replicated-mode-using-traef

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!