You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: bootstrap init container can crash forever on "resource name may not be empty" (server secret) #11446
I have searched for an existing issue, and could not find anything. I believe this is a new bug.
I have read the troubleshooting guide
I have read the troubleshooting guide and I think this is a new bug.
I am running a supported version of CloudNativePG
I have read the troubleshooting guide and I think this is a new bug.
Contact Details
No response
Version
trunk (main)
What version of Kubernetes are you using?
1.36
What is your Kubernetes environment?
Self-managed: kind (evaluation)
How did you install the operator?
YAML manifest
What happened?
Since #11319, bootstrap (init/join/recovery/pgBaseBackup/restoresnapshot) runs as an init container inside the instance pod itself, instead of a separate Job. This lets bootstrap start much sooner than before, right after the pod is created.
If the pod's bootstrap init container starts before the operator finishes writing Cluster.Status.Certificates.ServerTLSSecret, the init container crashes with:
Error while getting server secret: resource name may not be empty
and never recovers. The retry inside refreshServerCertificateFiles (pkg/reconciler/instance/certificate/reconciler.go) only retries the SecretGet() call with exponential backoff. It does not re-read the Cluster object. The Cluster is fetched once, earlier, by the caller (for example join/cmd.go). If Status.Certificates.ServerTLSSecret was empty at that one read, the secret name stays empty for every retry in this loop, so every retry fails the same way.
The only way to recover is a full container restart (kubelet's own crash-loop retry), because that re-reads the Cluster from scratch. In our testing, this sometimes did not recover even after many container restarts over several minutes because the initial get could retrieve stale data, leaving the cluster stuck.
Before #11319, the separate Job always started later, so the operator normally had enough time to set Status.Certificates first. This bug seems to have been hidden until bootstrap moved earlier.
Cluster resource
N/A — not tied to a specific cluster spec, reproducible with any bootstrap type that runs through the new init-container path.
Relevant log output
{"level":"info","msg":"Error accessing server TLS Certificate. Retrying with exponential backoff.","secret":""}
{"level":"error","msg":"Error while getting server secret","error":"resource name may not be empty"}
Activity
fix(bootstrap): wait for certificate status before refreshing secrets (…
fix(bootstrap): wait for certificate status before refreshing secrets (…
fix(bootstrap): wait for certificate status before refreshing secrets (…
fix(bootstrap): wait for certificate status before refreshing secrets (…