Skip to content

[Bug]: bootstrap init container can crash forever on "resource name may not be empty" (server secret) #11446

Description

@mnencia

Is there an existing issue already for this bug?

  • 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 Secret Get() 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"}

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. self-assigned this
    on Sep 7, 2026
  2. added theissue type on Sep 7, 2026
  3. added
    bug 🐛
    on Sep 7, 2026
  4. added 2 commits that reference this issue on Sep 9, 2026
    05b5dcc
    864e09e
  5. added a commit that references this issue on Sep 9, 2026
    7dd2f3b
  6. added a commit that references this issue on Sep 9, 2026
    c49704c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug 🐛

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions