On a cert-manager cluster, nobody runs a renew command. cert-manager is a controller. It records a renewal time for each Certificate, and when that time arrives it requests a new certificate and writes it into the same Secret. For a 90-day Let's Encrypt certificate (opens in a new tab) with default settings, renewal starts at day 60.
The rest of this article covers what sets that time, what happens when it arrives, the settings that change it, and how renewal fails and retries. The field names, defaults, and formulas come from cert-manager's Go API reference for the cert-manager.io/v1 types. That reference already lists fields added in v1.21.0.
How does cert-manager renew a certificate?
Each Certificate resource is a standing order: these names, from this issuer, stored in this Secret. The controller keeps comparing the order with what the Secret holds. After every issuance it writes status.renewalTime. The API reference describes that field as "the time at which the certificate will be next renewed. If not set, no upcoming renewal is scheduled."
When renewalTime passes, the controller does three things:
- It creates a new CertificateRequest.
- The issuer signs it.
- The controller writes the new certificate and private key into the Secret named in
spec.secretName.
That Secret is "automatically created and managed by this Certificate resource". Its name never changes, so anything that refers to it keeps working.
This is why there is no cron job to schedule and no renew step in a pipeline. My own k3s setup, described in how cert-manager renews my wildcard certificate (opens in a new tab), relies on exactly this. The Certificate there sets no duration and no renewBefore.
What sets the renewal time
Three fields on the Certificate spec decide when renewal starts. All three have defaults, so most Certificates set none of them.
| Field | Default | Limits from the API reference |
|---|---|---|
duration | 90 days | Minimum 1 hour. The issuer may ignore it. |
renewBefore | 1/3 of the issued certificate's lifetime | Minimum 5 minutes. Go time.ParseDuration units (for example h, m, s). |
renewBeforePercentage | unset | Integer between 0 and 100, exclusive. Cannot be combined with renewBefore. |
The lifetime that counts is the real one
The reference says: "The actual lifetime of the issued certificate is used to determine the renewal time." This matters most for ACME issuers such as Let's Encrypt. You ask for a duration, but the CA decides the lifetime, and the issuer "may choose to ignore the requested duration".
So cert-manager does not compute the renewal time from your spec. It computes it from the notBefore and notAfter of the certificate it actually received. A certificate that comes back shorter than you asked for will renew sooner, with no change on your side.
The example: one 90-day certificate
Take one certificate and carry it through the article: app.example.com, issued by Let's Encrypt with a 90-day lifetime.
| Setting | Renews this long before expiry | Renewal starts at |
|---|---|---|
| Nothing set (default 1/3) | 30 days | day 60 |
renewBefore: 720h | 30 days | day 60 |
renewBefore: 360h | 15 days | day 75 |
renewBeforePercentage: 25 | 22.5 days | day 67.5 |
The reference gives the same arithmetic on smaller numbers:
- A 60-minute certificate with
renewBefore=10mstarts renewing 50 minutes after issue. - With
renewBeforePercentage25, the same certificate renews at 45 minutes.
The default fraction of one third scales with the lifetime. That is the main reason to leave renewBefore unset when the CA controls the lifetime. A fixed renewBefore that suits 90 days can be too large for a shorter certificate. The failures section returns to this.
Where to read it
Three status fields tell you everything about timing: status.notBefore, status.notAfter, and status.renewalTime. Read them straight from the Certificate:
kubectl -n default get certificate app-example-com \
-o jsonpath='{.status.notBefore}{"\n"}{.status.notAfter}{"\n"}{.status.renewalTime}{"\n"}'For the example with defaults, the gap between notBefore and renewalTime should be two thirds of the gap between notBefore and notAfter. If renewalTime is empty, the reference says no renewal is scheduled. Find out why before anything else.
What happens when renewalTime arrives
A new CertificateRequest, every time
Each renewal creates a new CertificateRequest. The reference calls a CertificateRequest "a one-shot resource" that "cannot be re-used", and its spec is immutable. cert-manager never edits the previous request; it makes another one.
The Certificate shows progress through two condition types:
Readyreports whether the Secret holds a valid certificate for the current spec.Issuingis set while a new certificate is being obtained.
Each CertificateRequest counts as one revision of the Certificate. A revision is created at first issuance, at each renewal, and whenever the spec changes. revisionHistoryLimit sets how many of those requests cert-manager keeps, and the documented default is 1. If you want to inspect older requests after a few renewals, raise it.
A new private key, by default
privateKey.rotationPolicy decides whether renewal also replaces the key:
Always: a new private key is generated whenever the certificate is re-issued. This is the default. The reference notes: "The default was changed fromNevertoAlwaysin cert-manager >=v1.18.0."Never: a key is generated only if none exists in the Secret. If the existing key has the wrong algorithm or size, cert-manager raises a warning and waits for you to fix it.
Other key defaults:
- Encoding is
PKCS1. - If you set
algorithmwithoutsize, RSA uses 2048 bits and ECDSA uses 256. - Ed25519 ignores
size.
The v1.18 change is the one that bites on upgrade. A Certificate created on an older version with no rotationPolicy used to keep its key across renewals. After v1.18, the same manifest gets a new key at the next renewal. Anything that depends on the old key breaks at that moment, such as a pinned public key or a copy of the key outside the Secret. If you need the old behavior, set rotationPolicy: Never explicitly before you upgrade.
For ACME issuers: an Order and Challenges
With Let's Encrypt behind the issuer, the CertificateRequest is handed to the ACME flow. The CA must see proof of domain control for each name again before it signs. That proof is a new HTTP-01 or DNS-01 challenge, which Let's Encrypt SSL explained (opens in a new tab) walks through.
The API reference does not document how cert-manager turns a CertificateRequest into ACME Order and Challenge resources. It also does not document where the new key is held while signing is in progress. I am not describing those internals here beyond the challenge itself.
The practical consequence is that renewal depends on your challenge path working on the day it runs. That might be a month after anyone last looked at it.
How the workload sees the new certificate
cert-manager's job ends when the Secret is updated. Whether your server starts using the new certificate depends on the consumer, not on cert-manager.
Some consumers watch the Secret and reload. My k3s article describes the Istio (opens in a new tab) gateway doing that. Other consumers read the certificate once at startup and keep serving the old one until a restart. Check your ingress controller's or application's documentation for this. It is the most common way a "renewed" certificate still expires in production.
Tuning renewal for the example
This Certificate requests app.example.com and spells out the defaults so you can see where each knob goes. It assumes a ClusterIssuer named letsencrypt-dns already exists. The k3s article (opens in a new tab) shows one.
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: app-example-com
namespace: default
spec:
secretName: app-example-com-tls
dnsNames:
- app.example.com
issuerRef:
group: cert-manager.io
kind: ClusterIssuer
name: letsencrypt-dns
duration: 2160h # 90 days, the documented default
renewBefore: 720h # 30 days; the default is 1/3 of the issued lifetime
privateKey:
rotationPolicy: Always # the default since v1.18.0kubectl apply -f certificate.yamlThe required fields are:
secretName.issuerRefwithname.- At least one of
commonName,literalSubject,dnsNames, oruris.
Everything under the comments is optional. For a Let's Encrypt certificate, I would delete duration and renewBefore again after reading this. duration is only a request the CA may ignore. The default renewBefore already follows the real lifetime.
The renewBefore trap
The reference gives minimums for renewBefore (5 minutes) but no maximum tied to the lifetime. Suppose you set renewBefore: 720h and the CA later issues certificates shorter than 30 days. The renewal time then falls at or before issuance.
My reading is that the Certificate would be due for renewal as soon as each new certificate arrives. The documentation does not spell this out, so treat it as inference. The safe options are:
- Leave
renewBeforeunset. - Use
renewBeforePercentage, which scales with the lifetime the same way the default does.
You cannot set renewBefore and renewBeforePercentage together.
Renewal windows (v1.21.0 and later)
cert-manager v1.21.0 added a renewal block of type CertificateRenewal, set at spec.renewal on the Certificate. It has these fields:
| Field | Values |
|---|---|
policy | RenewBefore or Disabled |
windows[].cron | a cron schedule for when a window opens; required |
windows[].windowDuration | how long the window stays open; required; must match ^([0-9]+(\.[0-9]+)?(s|m|h))+$, for example 2h or 1h30m |
windows[].timezone | an IANA time zone name; defaults to UTC |
The spec comment says that with policy: RenewBefore the controller respects renewBefore and renewBeforePercentage.
The reference does not say how the windows combine with the computed renewal time. For example, it does not say whether renewal waits for the next window after renewalTime, or what happens if no window opens before expiry. Read the v1.21 release notes before you rely on windows to keep renewals inside a maintenance period. Also check your installed version first: on v1.20 the field does not exist.
Checking and forcing a renewal
Start with the list view and the conditions:
kubectl get certificate -A
kubectl -n default describe certificate app-example-comdescribe shows the Ready and Issuing conditions, the status times, and recent events. The events usually say why a renewal has not started or has not finished.
Waiting 60 days to see whether renewal works is a poor test. cert-manager's CLI, cmctl, has a command that marks a Certificate for renewal immediately. Then you can list the objects the renewal creates:
cmctl renew app-example-com -n default
kubectl -n default get certificaterequest,order,challengeA successful forced renewal produces three visible changes:
- A new CertificateRequest appears.
- The Certificate returns to
Ready=True. status.notBeforeandstatus.renewalTimemove forward.
Then check what clients actually receive. That catches the consumer-reload problem from earlier:
echo | openssl s_client -connect app.example.com:443 -servername app.example.com 2>/dev/null \
| openssl x509 -noout -datesIf openssl still shows the old notBefore after the Secret has changed, cert-manager did its part and the consumer did not reload.
On Let's Encrypt production, do not force renewals in a loop while testing. Repeated issuance for the same set of names counts against the CA's rate limits. Point the Certificate at a staging issuer while you experiment.
When renewal fails
The retry schedule
If an issuance fails, cert-manager sets status.lastFailureTime. The reference gives the delay before the next attempt as:
time.Hour * 2 ^ (failedIssuanceAttempts - 1)| Failed attempts | Wait before the next try |
|---|---|
| 1 | 1 hour |
| 2 | 2 hours |
| 3 | 4 hours |
| 4 | 8 hours |
| 5 | 16 hours |
The delay doubles each time. The part of the reference I read states no upper bound, so do not plan around a specific cap. lastFailureTime is cleared after a successful issuance, and the count starts again.
What keeps working meanwhile
A failed renewal does not touch the Secret, because only a signed certificate is written there. With the default one-third margin, the example still has up to 30 days of validity when renewal first fails.
That margin is large, and the backoff spends it. After five failures, the next attempt is 16 hours away. A broken DNS token or a removed HTTP route can therefore eat a week without anyone noticing, unless something alerts on expiry.
Walking the chain
When a Certificate is stuck, describe the objects in the order they are created. Each one's events say why the next has not appeared:
kubectl -n default describe certificate app-example-com
kubectl -n default describe certificaterequest
kubectl -n default describe order
kubectl -n default describe challenge
kubectl -n cert-manager logs deployment/cert-manager --tail=100The failures I hit on my own cluster are written up in the k3s article. A DNS-01 self-check timed out because pods could not reach port 53. A Certificate stayed False because the DNS API token Secret did not exist yet. Both are specific to DNS-01, and both show up in the Challenge's events rather than on the Certificate.
What to check on your cluster next
- Read
renewalTimefor every Certificate. Runkubectl get certificate -A -o jsonpath='{range .items[*]}{.metadata.namespace}/{.metadata.name} {.status.renewalTime}{"\n"}{end}'. An empty value means nothing is scheduled. - Check your cert-manager version against the key rotation change. If you upgraded past v1.18 and anything depends on a stable key, set
rotationPolicy: Neveron those Certificates. - Look for fixed
renewBeforevalues on ACME Certificates. Replace them with the default or withrenewBeforePercentageif the CA's lifetime can drop below them. - Force one renewal on a staging issuer. Confirm with
opensslthat the consumer serves the new certificate without a restart. - Add an expiry alert that does not depend on cert-manager reporting its own success. Base it on the certificate's real
notAfter. That way, a stalled backoff surfaces with weeks to spare rather than hours.



Discussion comments
No comments yet. Start the discussion.