traefik: Manually trigger Traefik to generate letsencrypt certificate using API
Do you want to request a feature or report a bug?
Feature
What did you expect to see?
The idea is I want to be able to ask Traefik to generate certificates based on an API call. Our system has a lot of domain names that are dynamically pointed to Traefik, so to make sure we don’t exceed letsencrypt we want to manually trigger traefik.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 64
- Comments: 32 (4 by maintainers)
Beside the mentioned API-call I’d really wish to see a button (per cert) in the dashboard which allows to force-renew individual certs.
If you are going to be manually managing your LE certificates, why not use a tool like Certbot to generate certificates, then just dynamically add them to Traefik?
Quick workaround:
@bodomic2 wrote:
This can be done with jq like this.
And don’t forget that acme.json requires 600 permission. (like me 😃
I bet everyone wishes this had been implemented today after the intermediate cert expired. Anyone else stuck in a “now what” moment?
I came across the same need. My scenario: I run a GKE cluster with a
traefik-ingress-controller
.The
traefik-ingress-controller-service
creates a LoadBalancer on GCE and routes traffic into traefik and from there it gets forwarded to my services.The issue: When LoadBalancer is created it has a health check attached. No traffic gets through the LoadBalancer until the HealthCheck is green. Since traefik requests the LE certificates immediately after launch (and does not retry in error case) there is not enough time for the health check to get green and allow initial traffic into the cluster for the
http challenge
.Currently I have to kill the pod and hope that the newly created one is ready fast enough to do the challenge.
A wait time for the LE process, a retry or API endpoint to trigger would really help
Actually, I just want to trigger Traefik and let it do the rest. Otherwise, I’ll have to take care of the setup for the challenge.
@ptruman I encountered the same issue, so I replaced
acme.json
with the following:And traefik did correctly re-generate all certificates.
I’m going to repeat my post because I’m afraid people who need a quick fix won’t see it because of the discussion
For people that need help to clean their
acme.json
file, I quickly created a simple tool to help to remove your certificates from theacme.json
(Traefik v2 only).https://github.com/ldez/traefik-certs-cleaner/
The process:
acme.json
fileThe readme contains examples for all the options (only 3 options).
https://github.com/traefik/traefik/issues/3652#issuecomment-1022423896
For people that need help to clean their
acme.json
file, I quickly created a simple tool to help to remove your certificates from theacme.json
(Traefik v2 only).https://github.com/ldez/traefik-certs-cleaner/
The process:
acme.json
file@darkl0rd for Traefik v1, the clean is a bit more complex but there are possibilities. In all cases, you will have to restart your Traefik instances.
FYI I’m a Traefik maintainer, I’m currently off but I took a few times to create this tool.
Ah, yes. Didn’t think about that. Sorry!
Thanks for that - my problem is, I run a large scale enterprise grade service - I can’t have our customers end up with warnings either; that will cause a sh*tstorm with our support department. I can’t remove the existing certificates either, because then I will have downtime, so I am really looking for a way to tell traefik - renew the certificates which are here; regardless of the expiry date.
Thanks for the solution @Austreelis, but I think there is no way to reissue 100+ certificates in one account in so short timeframe anyways… I feel like bunch of websites will go nuts these days. (came here after a letter about TLS-ALPN-01 validation method revocation)
I deleted acme.json to try to force a regen, but it’s only generating one cert (and then I got rate limited). Nearly all of my routers just have sans defined (which worked before) - only one has a main and that’s the only one being requested when I have a blank acme.json file…
FTR, there seems to be a separate issue https://github.com/containous/traefik/issues/2174 for the problem described by @soupdiver above.