Issue:
Having trouble getting SSL Certs as well as basic services up
My previous k3s setup was as follows:
Cert-Manager for SSL Certs using cloudflare/letsencrypt for issuing certs
Traefik for Ingresses listening on a specific IP provided by metallb load balancer (192.168.200.150)
A cloudlflare tunnel was used for all the exposed services, which would point to 192.168.200.150
I'm trying to replicate this, but using docker swarm.
I was able to get traefik up and running (as far as being able to get the dashboard accessible - though I can't seem to access it with insucure: false, just get 404 error)
Below are the files I have so far:
docker-compose.yml:
services:
traefik:
image: traefik:v2.11
command:
- "--configFile=/etc/traefik/traefik.yml"
environment:
CF_API_EMAIL: <REDACTED>
CF_API_KEY: <REDACTED >
ports:
- "80:80"
- "443:443"
- "8081:8081"
labels:
- "traefik.enable=true"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "./traefik.yml:/etc/traefik/traefik.yml"
- "./acme.json:/acme.json"
- "./entrypoint.sh:/startup.sh"
- "./dynamic_conf.yml:/dynamic_conf.yml"
networks:
- traefik-public
entrypoint: "/startup.sh"
sd.lukium.ai:
image: lukium/sd.lukium.ai:0.5.3
labels:
- "traefik.enable=true"
- "traefik.http.routers.sd.rule=Host(`sd.lukium.ai`)"
- "traefik.http.routers.sd.entrypoints=web,websecure"
- "traefik.http.routers.sd.tls=true"
- "traefik.http.routers.sd.tls.certresolver=letsencrypt"
networks:
- traefik-public
networks:
traefik-public:
external: true
traefik.yml:
# Global Traefik configuration
global:
checkNewVersion: true
sendAnonymousUsage: false
# Define HTTP and HTTPS entryPoints, including one for the dashboard
entryPoints:
web:
address: ":80"
http:
redirections:
entryPoint:
to: websecure
scheme: https
permanent: true
websecure:
address: ":443"
traefik:
address: ":8081"
# Enable Docker provider
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
watch: true
exposedByDefault: false
swarmMode: true
network: traefik-public
file:
filename: /dynamic_conf.yml
# API and Dashboard configuration, secured by basic auth
api:
dashboard: true
insecure: true
# Log settings
log:
level: DEBUG
# Enable Let's Encrypt automatic SSL with Cloudflare DNS challenge
certificatesResolvers:
letsencrypt:
acme:
email: <REDACTED>
storage: /acme.json
dnsChallenge:
provider: cloudflare
delayBeforeCheck: "0"
resolvers:
- "1.1.1.1:53"
- "1.0.0.1:53"
dynamic_conf.yml:
tls:
options:
default:
minVersion: VersionTLS12
http:
routers:
dashboard:
rule: "Host(`traefik.lukium.ai`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))"
service: api@internal
entryPoints:
- "traefik"
middlewares:
- "auth"
tls:
certResolver: letsencrypt
domains:
- main: lukium.ai
sans:
- '*.lukium.ai'
middlewares:
auth:
basicAuth:
users:
# List of users allowed to access the dashboard, replace with your own
- "<REDACTED>"
entrypoint.sh: #this is just to set the correct perms for acme.json since it's coming from windows
#!/bin/sh
chmod 600 /acme.json
exec /entrypoint.sh "$@"
Main errors I'm getting:
Unable to obtain ACME certificate for domains
error="unable to generate a certificate for the domains
error: one or more domains had a problem: lukium.ai *.lukium.ai
acme: error presenting token: cloudflare: failed to find zone lukium.ai
ListZonesContext command failed: Invalid request headers (6003)
I can't paste the whole log section because it complains about there being too many links (the domain name that the cert is being created for)
I know the cloudflare info is right:
I created a new token, ensuring that it has zone - zone - read and zone - dns - edit perms for all zones
I also know that the tunnel is working, because I have tested accessing the dashboard directly via the tunnel
Any help would be appreciated. Thanks!