I would like to configure Traefik running under Kubernetes to work with an internal ACME certificate authority. I've tried to configure Traefik to trust the CA root certificate by injecting the following configuration into the ingress Deployment:
When traefik attempts to contact the ACME CA, I see:
kind-traefik-d5f9f4fbd-wnfxt kind-traefik time="2022-09-27T11:33:46Z" level=error msg="Unable to obtain ACME certificate for domains "acme-example.apps.house": cannot get ACME client get directory at 'https://ca.apps.house/acme/acme/directory': Get "https://ca.apps.house/acme/acme/directory\": x509: certificate signed by unknown authority" routerName=default-acme-example-08434a79de43f1c8755b@kubernetescrd rule="Host(acme-example.apps.house)" providerName=step-ca.acme ACME CA="https://ca.apps.house/acme/acme/directory"
But I can verify that the server at ca.apps.house is presenting a certificate signed by the relevant CA certificates:
How do I correctly configure Traefik to trust the configured CA certificates when connecting to the ACME server? I'm wondering if TRAEFIK_SERVERSTRANSPORT_ROOTCAS isn't consulted in this case.
Okay, after some further work I see that Traefik itself doesn't provide any facility for injecting additional trusted CA certificates. The only solution is to install them at the OS level.
Since I'm installing Traefik via the helm chart, that customization ends up being a little tricky: the helm chart doesn't provide any facility for doing this. I ended up passing the helm chart output through kustomize so that I can patch the Deployment.
This does require me to manually calculate the certificates hashes in order to mount them at the right places, but now things are working: I'm able to create new IngressRoutes and Traefik will successfully request a certificate from the ACME server.
I don't know if this is the best solution for setting things up when using the helm chart. I do think the documentation could be more clear around this use case (that is, using an internal ACME server), and I'm curious how other folks are doing this in their kubernetes deployments.
These environmental variables can be used to tell traefik to trust an internal CA certificate
- LEGO_CA_CERTIFICATES=/.step/certs/root_ca.crt
- LEGO_CA_SERVERNAME=stepca.internal