The check that fails#
Every certificate has a validity period from notBefore through notAfter, inclusive, and the client checks it against its own current time. OpenSSL returns X509_V_ERR_CERT_NOT_YET_VALID, certificate is not yet valid, when notBefore is after the current time; Node.js reports the code CERT_NOT_YET_VALID. RFC 5280 validity · OpenSSL verify error codes · Node.js TLS error codes
Go uses one message for both date failures, x509: certificate has expired or is not yet valid, and adds the detail that settles which: current time followed by its clock is before the certificate's notBefore, or is after its notAfter. The log line alone shows the gap. Go x509 verify
The client compares with its own clock and nothing else. A server cannot fix a client whose clock is wrong, and a client cannot accept a certificate dated in its future.
Two causes#
- The client clock is behind. The host lost time synchronisation, never had it, or booted with a wrong hardware clock. Every certificate issued recently enough looks not yet valid, and every TLS dependency the client calls can fail at once. A container reads the host's clock: Linux time namespaces do not virtualise
CLOCK_REALTIME, so a container on a skewed host is skewed by the same amount. time_namespaces - The certificate is brand new. A dependency deployed a certificate whose notBefore is the minute it was issued. A client whose clock is a few seconds or minutes behind fails until its clock passes notBefore, then recovers without any change. Only certificates issued very recently trigger it, and only on clients that are behind.
The same clock fault in the other direction makes current certificates look expired: a client running ahead fails with certificate has expired near a certificate's notAfter. That case starts at which certificate expired.
Measure the client's clock#
On the failing host, read the clock in UTC and the state of the time service. These commands only read. chronyc tracking shows System time, the offset between chrony's NTP clock and the system clock, and Leap status, which reads Not synchronised when chrony has no usable source. chronyc sources lists the sources it uses. chronyc
date -u
chronyc tracking
chronyc sources -v
On systemd hosts without chrony, timedatectl status shows whether network time synchronisation is active, as System clock synchronized and NTP service; timedatectl timesync-status shows systemd-timesyncd's state. timedatectl
timedatectl status
timedatectl timesync-status
On EC2, the Amazon Time Sync Service answers at 169.254.169.123 (and fd00:ec2::123 on Nitro instances), and a synchronised chrony shows it as the selected source. Amazon Time Sync Service
From inside a container, date -u is enough, since it reads the host's clock: time_namespaces
kubectl exec -n NAMESPACE POD -c CONTAINER -- date -u
For a quick outside reference, a web server's Date response header gives the time at which the server generated the response, to the second. RFC 9110 Date
curl -sI https://www.example.com/ | grep -i '^date:'
Read the certificate's notBefore#
Fetch the certificate the dependency serves and print its dates. openssl s_client · openssl x509 -dates
openssl s_client -connect payments.example.com:443 -servername payments.example.com \
</dev/null 2>/dev/null | openssl x509 -noout -subject -dates
Run it from a host whose clock you trust, too. If you saved the chain, openssl verify -attime checks it at a time you choose, given in seconds since the Unix epoch, without touching any clock; run it at the failing client's time and again a few minutes later. openssl verification options
openssl verify -attime "$(date -u -d '2026-11-23 10:02:00' +%s)" \
-untrusted intermediates.pem leaf.pem
Read the result#
| Client clock vs reference | notBefore vs reference | Points to |
|---|---|---|
| Behind by minutes or more | Days or months ago | Client clock |
| Behind by seconds | Moments ago | New certificate met a slightly slow clock |
| Correct | In the future | Certificate issued with a future date |
| Correct | In the past | Not a date problem; read the full error |
The third row is rare and belongs to the issuer of the certificate. The fourth usually means a different certificate in the chain failed; print each one's dates as in which certificate expired.
A worked example with two outcomes#
This example is illustrative. At 10:02 UTC, checkout pods on one Kubernetes node log certificate is not yet valid calling payments.example.com. Pods on other nodes work.
In the first outcome, date -u in an affected pod prints 09:41, twenty-one minutes behind. On the node, chronyc tracking shows Leap status : Not synchronised: a network change blocked NTP to the node, and its clock drifted for days. The payments certificate's notBefore is two weeks old. Every TLS dependency of pods on that node is at risk; the fix is the node's time source.
In the second outcome, the pods' clock is four seconds behind the reference, and the payments certificate's notBefore is 10:01:58 UTC: the payments team renewed it at 10:02. Calls failed for a few seconds, then recovered on their own. Nothing needs fixing beyond tighter time sync, and the payments team may choose to issue certificates before deploying them.
Limits#
date and chronyc show the clock now. A clock that was stepped back into line after the failure will look correct; chrony's log or the time service's history tells you whether it moved. Errors that stopped on their own around a time step point to the clock.
A client with a wrong clock can fail in other ways too: mutual TLS servers reject a client certificate as expired or not yet valid by their own clock, so check the server's clock when a client certificate looks wrong only to one server. See mutual TLS client certificate rejected, and for other layers the hub for runtime dependency failures.
Questions#
Can a container have its own clock?
Not for wall-clock time on Linux. Time namespaces can offset the monotonic and boot-time clocks, but not CLOCK_REALTIME, which certificate checks use. A container's wall clock is the host's.
Why did only one node fail?
All pods on a node share its clock. Errors confined to one node or host, across several TLS dependencies, point at that host's time synchronisation.
Should the server send certificates with an earlier notBefore?
That is the issuer's choice. The client fix is a synchronised clock, which you can check with chronyc tracking or timedatectl.