I have traefik on 3 swarm managers, and a single lego container floating in the swarm to do the acme foo, with shared files/certificates sitting on NFS. Each manager has the certifcates volume mounted.
Swarm is a live environment so certs need to be added after traefik has started up and running.
Traefik watches providers.file.directory=/lego/traefik
for an updated certificates.yaml
file, which contains seperate cert/keys in the following format:
# Dynamic configuration
tls:
certificates:
- certFile: /path/to/domain.cert
keyFile: /path/to/domain.key
- certFile: /path/to/other-domain.cert
keyFile: /path/to/other-domain.key
I have also tried inline certificates but the behavior is still the same.
This works well, but only after the traefik containers have managed to soft update. at first there are often default traefik certs served when other of the traefik containers will be serving the legit le cert files. Something tells me that all the Traefik containers are not noticing the update to the shared dynamic configuration that exists in the /lego/traefik
directroy.
from the logs, here is the error I get:
time="2023-02-23T08:35:59Z" level=debug msg="Serving default certificate for request: \"pinky.example.com\""
time="2023-02-23T08:35:59Z" level=debug msg="http: TLS handshake error from 10.0.0.3:46772: remote error: tls: unknown certificate"
and this is random, so traefik is aware of the certificate sometimes. I would imagine that 1 or 2 of the 3 traefik containers is not recognizing the change from providers.file.directory=/lego/traefik
I am running browser/cert checks in an incognito window so no previous requests should be affecting the situation
If I hard reset traefik then certificates are served without fail.
So my question :).
What is the nature of the providers.file.directory
, is this compatible with NFS?