Quick revision
The short answer
Let cert-manager or a similar tool renew certificates into a mounted volume, mark the SSL bundle with reload-on-update so Spring Boot watches the files and swaps the new certificate in without a restart (supported by Tomcat and Netty; check your server), and apply the same bundle to outgoing clients through RestClientSsl, WebClientSsl or the SslBundles bean. Alert on expiry dates through metrics or health so renewal failures are seen early, and test reload in staging before relying on it.
What to remember
In this answer, we removed restarts from certificate renewal. cert-manager renews into a mounted volume, the SSL bundle with reload-on-update makes Boot watch the files and switch the server certificate after a quiet period, and the same bundle reaches outgoing clients through RestClientSsl, WebClientSsl or SslBundles, rebuilding clients when the bundle changes. Expiry alerts on the served certificate catch failed renewals early, and a staging test proves the reload before we rely on it.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Let cert-manager or a similar tool renew certificates into a mounted volume, mark the SSL bundle with reload-on-update so Spring Boot watches the files and swaps the new certificate in without a restart (supported by Tomcat and Netty; check your server), and apply the same bundle to outgoing clients through RestClientSsl, WebClientSsl or the SslBundles bean. Alert on expiry dates through metrics or health so renewal failures are seen early, and test reload in staging before relying on it.
Why this question is asked
Short-lived certificates are good security, because a stolen key is useful for weeks rather than years. But with 90 day certificates, every service renews four times a year, and if renewal means a restart, that is four chances a year per service to cause an incident. Interviewers ask this design question to see whether we can remove the restart entirely and also cover the less obvious half: outgoing clients that present certificates. In this answer, we will recap how renewal reaches the pod, configure server reload, make clients follow the same bundle, add expiry alerts, and plan how to test the whole chain.
1A Quick Recap of the Renewal Chain
Renewal has two halves. The first is getting a new certificate onto the machine. In Kubernetes, cert-manager watches a Certificate resource, requests a new certificate from the authority some days before expiry, and writes it into a Secret. If the Secret is mounted as a volume, the kubelet updates the files in the pod automatically, typically within a minute or two.
The second half is the application noticing. A Java server loads the key and certificate into memory at startup, so without help it keeps serving the old certificate until it restarts, and when that certificate expires, clients start failing. SSL bundle reloading, added in Spring Boot 3.2, closes this gap.
- cert-manager renews before expiryfor example 30 days before
- Secret updatednew
tls.crtandtls.key - kubelet refreshes the mounted filesnot for
subPathmounts - Boot file watcher sees the changewaits for the quiet period
- Bundle reloadedserver presents the new certificate
- Clients rebuilt or refreshedthrough update handlers
6 steps in order. Play them, or step through them one at a time.
2Reloading the Server Certificate Without a Restart
We mark the bundle with reload-on-update. Boot then watches the files and, when they change, rebuilds the bundle and tells the web server to use it for new connections.
The quiet period matters because the certificate and key are written as separate files. Without it, Boot could reload after the certificate changed but before the key did, and the pair would not match. Waiting until the files stop changing avoids that.
There are two catches. Hot reload is supported by Tomcat and Reactor Netty; if a service uses another server, check your version before relying on it. And Kubernetes does not update files mounted with subPath, so a mount that picks single files that way never sees the renewal. Mounting the whole Secret as a directory avoids that trap.
3Giving Outgoing Clients the Same Bundle
Services that call others with client certificates, for mutual TLS, have the same problem on the client side. Boot lets us apply a named bundle to RestClient and WebClient, so the client uses the same managed certificate as the server.
Notice the comment about when the SSL context is built. Reloading the bundle updates the registry, but a RestClient built at startup may keep the SSLContext it was given. So a design that relies on client reload either rebuilds the client in an update handler, as in the sketch, or looks the bundle up again when it creates connections. This is exactly the kind of behaviour to confirm in staging. For code that is not a Spring HTTP client, the SslBundles bean gives the bundle's SSLContext directly.
4Alerting on Expiry Before It Hurts
Reload removes restarts, but it also removes the restart that used to hide a broken renewal: if cert-manager cannot reach the authority, nothing changes and nobody notices until the certificate expires. So we need an alert that fires while there is still time to act.
Recent Boot versions can report certificate information from SSL bundles through Actuator, an ssl health indicator that warns about certificates close to expiry and an ssl section in the info endpoint (Boot 3.4 and later; check your version). Alongside that, cert-manager exports metrics with each certificate's expiry time, and the platform can alert when any certificate in use has less than 14 days left. We alert on the certificate the server actually presents, not only on the Secret, because a renewal that never reached the app still leaves the old certificate in use.
5Testing Reload Before Relying on It
I would not trust reload until we have watched it work in an environment like production. In staging, we issue a certificate with a very short lifetime, for example one hour, let cert-manager renew it, and check from outside that the served certificate changes without a restart. We also run a load test during the reload to confirm that open connections are not dropped, and we repeat the test for a service that uses a client bundle, calling a partner stub that requires a client certificate.
Then we keep testing it. A scheduled job that compares the served certificate's expiry with the Secret's expiry catches the day an image change or a new mount quietly breaks the chain.
| Part | Solves | Watch out for |
|---|---|---|
| cert-manager into a volume | New certificate reaches the pod | subPath mounts never update |
| reload-on-update | Server switches without restart | Server support; quiet period |
RestClientSsl, WebClientSsl | Clients use the same bundle | Rebuild clients after reload |
| Expiry alerts | Failed renewals seen early | Alert on the served certificate |
| Staging reload test | Proof before relying on it | Repeat after platform changes |
6Follow-up questions
Why not just restart pods after each renewal?
A rolling restart can work, but it ties certificate renewal to deploy safety, and every restart risks the connection errors we work hard to avoid. With 200 services renewing every 90 days, that is hundreds of extra restarts a year. Reload makes renewal a non-event.
Do existing connections break when the certificate is reloaded?
No. The certificate is only used during the TLS handshake, so connections already open keep working and new connections use the new certificate. That is one of the things the staging test under load confirms.
Would a service mesh remove the need for this?
For traffic between services, a mesh can terminate mTLS in a sidecar and rotate certificates automatically, so the application uses plain HTTP inside the pod. The application still needs SSL bundles when it must terminate TLS itself or present certificates to systems outside the mesh.
7Conclusion
In this answer, we removed restarts from certificate renewal. cert-manager renews into a mounted volume, the SSL bundle with reload-on-update makes Boot watch the files and switch the server certificate after a quiet period, and the same bundle reaches outgoing clients through RestClientSsl, WebClientSsl or SslBundles, rebuilding clients when the bundle changes. Expiry alerts on the served certificate catch failed renewals early, and a staging test proves the reload before we rely on it.
Open with
I would split it into getting the new certificate to the pod and getting the app to use it without a restart. For the first half, cert-manager renews the certificate well before expiry into a Secret, mounted as a whole directory, not with subPath, so the kubelet updates the files.
Then, if they want more
For the second half, I define the server certificate as an SSL bundle and set reload-on-update to true. Boot then watches the files, waits for the quiet period so the certificate and key are both written, and reloads the bundle, so new handshakes get the new certificate and open connections are not affected.
That works for Tomcat and Netty, so I would check the server a service uses.
For outgoing calls with client certificates, I apply the same kind of bundle to RestClient or WebClient with RestClientSsl or WebClientSsl, or use the SslBundles bean directly, and because a client's SSL context is built once, I would rebuild the client from a bundle update handler.
Since restarts no longer hide failed renewals, I add expiry alerts, using cert-manager metrics and Boot's SSL health and info, on the certificate actually served, warning at about 14 days. Finally I test reload in staging with short-lived certificates under load before relying on it.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Spring Boot 3.2
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Boot reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Certificates in your services expire every 90 days and restarts for renewal cause...": https://scrivio-interview-library.netlify.app/spring-boot/embedded-servers/2ef88f0eea/