cilium (Fix): hubble-relay certificate chain - expired rotating CA #1771

Merged
ginjiruu merged 1 commit from hubble-ca-expiry into main 2026-11-21 02:59:37 +00:00
Owner

Fixes the cilium HelmRelease failure on mini (Ready=False since 2026-11-20 16:29Z, right after the #1753 renovate bump to 1.20.5).

Root cause

hubble-relay crash-loops (138+ restarts) with:

transport: authentication handshake failed: tls: failed to verify certificate:
x509: certificate has expired or is not yet valid: current time 2026-11-21T01:19:01Z is after 2026-10-29T14:51:50Z

The served leaf is fine: *.default.hubble-grpc.cilium.io, valid to 2029-08-31. What expired is the CA in the leaf secrets' ca.crt:

  • cert-manager/internal-root-ca is a cert-manager Certificate with no duration, so it gets the 90-day default and renews about every 60 days. cert-manager 1.21's default rotationPolicy: Always gives every renewal a new key. It is on revision 3 now (valid 2026-09-29 to 2026-12-28).
  • cilium issues the hubble leaves from ClusterIssuer internal-ca-issuer with certValidityDuration: 1095 (3 years). Issued 2026-08-31, they're nowhere near renewal, so their secrets still carry the CA generation that expired 2026-10-29. They're signed by a key that no longer exists.
  • The agent and relay verify each other against that dead ca.crt. The old relay pod survived on an established connection; the 1.20.5 rollout started a new pod, which can't handshake, so helm's wait fails on Deployment/hubble-relay status: Failed.

Only these two leaves come from internal-ca-issuer; nothing else trusts that CA.

Fix

  • internal-root-ca: duration: 87600h (10y), renewBefore: 8760h, privateKey.rotationPolicy: Never. With a stable key, a leaf keeps verifying across CA renewals, which is the bug class here. The change re-issues the CA once with its current key (rotationPolicy Never reuses the key in the secret).
  • cilium hubble.tls.auto.certValidityDuration: 365. Leaves are shorter than the CA and renew yearly, picking up the current bundle.

Rollout (after merge)

  1. Flux applies cert-manager-resources, which re-issues internal-root-ca (same key, 10y). Check: kubectl -n cert-manager get certificate internal-root-ca -o jsonpath='{.status.notAfter}' gives about 2036.
  2. The cilium HR upgrade changes the hubble Certificate durations. If cert-manager doesn't re-issue them by itself, force it:
    cmctl renew -n kube-system hubble-server-certs hubble-relay-client-certs
    (or kubectl -n kube-system delete secret hubble-server-certs hubble-relay-client-certs; cert-manager recreates them).
  3. The agent reloads the projected certs (kubelet sync ≤ ~1 min, cilium's certloader watches the files). Then kubectl -n kube-system rollout restart deploy/hubble-relay.
  4. kubectl -n kube-system get hr cilium → Ready. hubble-relay Running, no restarts. hubble status via the relay works.

Risk: datapath is unaffected. Hubble TLS is observability only, and cilium agents don't restart for a cert change.

Checks

  • kustomize build clusters/mini/cilium OK.
  • kubectl --context mini apply --dry-run=server of cluster-issuers.yaml accepted.
  • generic-templates/standard/cert-manager is also used by other clusters that render generic-templates (not c1, which is cluster-local). The change is safe there too: any cert-manager CA gets the same fix.
Fixes the cilium HelmRelease failure on mini (Ready=False since 2026-11-20 16:29Z, right after the #1753 renovate bump to 1.20.5). ## Root cause `hubble-relay` crash-loops (138+ restarts) with: ``` transport: authentication handshake failed: tls: failed to verify certificate: x509: certificate has expired or is not yet valid: current time 2026-11-21T01:19:01Z is after 2026-10-29T14:51:50Z ``` The served leaf is fine: `*.default.hubble-grpc.cilium.io`, valid to 2029-08-31. What expired is the **CA in the leaf secrets' `ca.crt`**: - `cert-manager/internal-root-ca` is a cert-manager `Certificate` with no `duration`, so it gets the 90-day default and renews about every 60 days. cert-manager 1.21's default `rotationPolicy: Always` gives every renewal a **new key**. It is on revision 3 now (valid 2026-09-29 to 2026-12-28). - cilium issues the hubble leaves from `ClusterIssuer internal-ca-issuer` with `certValidityDuration: 1095` (3 years). Issued 2026-08-31, they're nowhere near renewal, so their secrets still carry the CA generation that expired 2026-10-29. They're signed by a key that no longer exists. - The agent and relay verify each other against that dead `ca.crt`. The old relay pod survived on an established connection; the 1.20.5 rollout started a new pod, which can't handshake, so helm's wait fails on `Deployment/hubble-relay status: Failed`. Only these two leaves come from `internal-ca-issuer`; nothing else trusts that CA. ## Fix - `internal-root-ca`: `duration: 87600h` (10y), `renewBefore: 8760h`, `privateKey.rotationPolicy: Never`. With a stable key, a leaf keeps verifying across CA renewals, which is the bug class here. The change re-issues the CA once with its **current** key (rotationPolicy Never reuses the key in the secret). - cilium `hubble.tls.auto.certValidityDuration: 365`. Leaves are shorter than the CA and renew yearly, picking up the current bundle. ## Rollout (after merge) 1. Flux applies `cert-manager-resources`, which re-issues `internal-root-ca` (same key, 10y). Check: `kubectl -n cert-manager get certificate internal-root-ca -o jsonpath='{.status.notAfter}'` gives about 2036. 2. The cilium HR upgrade changes the hubble Certificate durations. If cert-manager doesn't re-issue them by itself, force it: `cmctl renew -n kube-system hubble-server-certs hubble-relay-client-certs` (or `kubectl -n kube-system delete secret hubble-server-certs hubble-relay-client-certs`; cert-manager recreates them). 3. The agent reloads the projected certs (kubelet sync ≤ ~1 min, cilium's certloader watches the files). Then `kubectl -n kube-system rollout restart deploy/hubble-relay`. 4. `kubectl -n kube-system get hr cilium` → Ready. hubble-relay Running, no restarts. `hubble status` via the relay works. Risk: datapath is unaffected. Hubble TLS is observability only, and cilium agents don't restart for a cert change. ## Checks - `kustomize build clusters/mini/cilium` OK. - `kubectl --context mini apply --dry-run=server` of `cluster-issuers.yaml` accepted. - `generic-templates/standard/cert-manager` is also used by other clusters that render generic-templates (not c1, which is cluster-local). The change is safe there too: any cert-manager CA gets the same fix.
Sign in to join this conversation.
No description provided.