我们有一个Docker Swarm集群,其中Consul + Traefik作为我们微服务的代理。已安装Traefik v1.6.1,现在我们必须配置通配符证书。我拥有自己的通配符证书。该证书是通配符证书(* .mydomain.com),用于支持我们在子域中以“ microservice2.mydomain.com”提供的微服务。 当然,我的配置可以很好地与ACme证书一起使用。因为我现在有自己的证书, 目前,我找不到有关如何将证书存储在秘密或领事中以及如何使其与命令行争论和docker标签一起使用的文档,如下所示? 如何在以下配置中添加证书以使其正常工作
version: "3.2"
services:
traefik_init:
image: traefik:1.6
command:
- "storeconfig"
- "--api"
- "--entrypoints=Name:http Address::80 Redirect.EntryPoint:https"
- "--entrypoints=Name:https Address::443 TLS"
- "--defaultentrypoints=http,https"
- "--acme"
- "--acme.storage=traefik/acme/account"
- "--acme.entryPoint=https"
- "--acme.httpChallenge.entryPoint=http"
- "--acme.onHostRule=true"
- "--acme.onDemand=false"
- "--acme.email=foobar@example.com"
- "--docker"
- "--docker.swarmMode"
- "--docker.domain=mydomain.com"
- "--docker.watch"
- "--consul"
- "--consul.endpoint=consul:8500"
- "--consul.prefix=traefik"
- "--debug"
networks:
- internal
deploy:
restart_policy:
condition: on-failure
depends_on:
- consul
traefik:
image: traefik:1.6
depends_on:
- traefik_init
- consul
command:
- "--consul"
- "--consul.endpoint=consul:8500"
- "--consul.prefix=traefik"
- "--logLevel=DEBUG"
- "--api"
- "--entrypoints=Name:http Address::80 Redirect.EntryPoint:https"
- "--entrypoints=Name:https Address::443 TLS"
- "--defaultentrypoints=http,https"
- "--acme"
- "--acme.storage=traefik/acme/account"
- "--acme.entryPoint=https"
- "--acme.httpChallenge.entryPoint=http"
- "--acme.onHostRule=true"
- "--acme.onDemand=false"
- "--acme.email=foobar@example.com"
- "--docker"
- "--docker.swarmMode"
- "--docker.domain=mydomain.com"
- "--docker.watch"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- internal
- traefik_proxy
ports:
- target: 80
published: 80
mode: host
- target: 443
published: 443
mode: host
- target: 8080
published: 8080
mode: host
deploy:
mode: global
placement:
constraints:
- node.role == manager
update_config:
parallelism: 1
delay: 10s
restart_policy:
condition: on-failure
labels:
- "traefik.enable=true"
- "traefik.backend=traefik"
- "traefik.frontend.rule=Host:traefik.mydomain.com"
- "traefik.port=8080"
- "traefik.docker.network=traefik_proxy"
consul:
image: consul:latest
command: "agent -server -bootstrap-expect=1 -ui -client 0.0.0.0 -bind '{{ GetInterfaceIP \"eth0\" }}'"
volumes:
- consul-data:/consul/data
environment:
- CONSUL_LOCAL_CONFIG={"datacenter":"us_east2","server":true}
- CONSUL_BIND_INTERFACE=eth0
- CONSUL_CLIENT_INTERFACE=eth0
ports:
- 8500:8500
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
networks:
- internal
networks:
traefik_proxy:
external: true
internal:
driver: overlay
volumes:
consul-data:
driver: local