[Bug]: kubectl cnpg report cluster --logs fails to gather
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
1.27 (latest patch), 1.26 (latest patch), 1.25 (latest patch), trunk (main)
What version of Kubernetes are you using?
1.34
What is your Kubernetes environment?
Self-managed: kind (evaluation)
How did you install the operator?
YAML manifest
What happened?
When running kubectl cnpg report cluster --logs cluster-example, the logs gathering always fails with the error:
Error: could not write report: when opening the log stream: previous terminated container "postgres" in pod "cluster-example-1" not found
This occurs in a perfectly healthy cluster (see the status output below), where I have cluster admin permissions. The issue occurs on all supported plugin versions (1.25.x, 1.26.x, 1.27.x) as well as main branch builds.
The resulting report contains no logs.
Cluster resource
Relevant log output
$ kubectl cnpg report cluster --logs cluster-example Error: could not write report: when opening the log stream: previous terminated container "postgres" in pod "cluster-example-1" not found $ kubectl cnpg status cluster-example Cluster Summary Name default/cluster-example System ID: 7566247159144882211 PostgreSQL Image: ghcr.io/cloudnative-pg/postgresql:18.0-system-trixie Primary instance: cluster-example-1 Primary promotion time: 2025-10-28 12:23:45 +0000 UTC (4h20m38s) Status: Cluster in a healthy state Instances: 3 Ready instances: 3 Size: 144M Current Write LSN: 0/8000000 (Timeline: 1 - WAL File: 000000010000000000000008) Continuous Backup status (Barman Cloud Plugin) ObjectStore / Server name: minio-store/cluster-example First Point of Recoverability: - Last Successful Backup: - Last Failed Backup: - Working WAL archiving: OK WALs waiting to be archived: 0 Last Archived WAL: 000000010000000000000007 @ 2025-10-28T12:35:19.649263Z Last Failed WAL: - Streaming Replication status Replication Slots Enabled Name Sent LSN Write LSN Flush LSN Replay LSN Write Lag Flush Lag Replay Lag State Sync State Sync Priority Replication Slot ---- -------- --------- --------- ---------- --------- --------- ---------- ----- ---------- ------------- ---------------- cluster-example-2 0/8000000 0/8000000 0/8000000 0/8000000 00:00:00 00:00:00 00:00:00 streaming async 0 active cluster-example-3 0/8000000 0/8000000 0/8000000 0/8000000 00:00:00 00:00:00 00:00:00 streaming async 0 active Instances status Name Current LSN Replication role Status QoS Manager Version Node ---- ----------- ---------------- ------ --- --------------- ---- cluster-example-1 0/8000000 Primary OK BestEffort 1.27.1 pg-operator-e2e-v1-34-0-worker cluster-example-2 0/8000000 Standby (async) OK BestEffort 1.27.1 pg-operator-e2e-v1-34-0-worker2 cluster-example-3 0/8000000 Standby (async) OK BestEffort 1.27.1 pg-operator-e2e-v1-34-0-worker3 Plugins status Name Version Status Reported Operator Capabilities ---- ------- ------ ------------------------------ barman-cloud.cloudnative-pg.io 0.8.0 N/A Reconciler Hooks, Lifecycle Service $ unzip report_cluster_cluster-example_2025-10-28T16\:54\:33Z.zip Archive: report_cluster_cluster-example_2025-10-28T16:54:33Z.zip creating: report_cluster_cluster-example_2025-10-28T16:54:33Z/ creating: report_cluster_cluster-example_2025-10-28T16:54:33Z/manifests/ inflating: report_cluster_cluster-example_2025-10-28T16:54:33Z/manifests/cluster.yaml inflating: report_cluster_cluster-example_2025-10-28T16:54:33Z/manifests/cluster-pods.yaml inflating: report_cluster_cluster-example_2025-10-28T16:54:33Z/manifests/cluster-jobs.yaml inflating: report_cluster_cluster-example_2025-10-28T16:54:33Z/manifests/events.yaml inflating: report_cluster_cluster-example_2025-10-28T16:54:33Z/manifests/cluster-pvcs.yaml creating: report_cluster_cluster-example_2025-10-28T16:54:33Z/logs/ inflating: report_cluster_cluster-example_2025-10-28T16:54:33Z/logs/cluster-example-1-postgres.jsonl $ cat report_cluster_cluster-example_2025-10-28T16:54:33Z/logs/cluster-example-1-postgres.jsonl "====== Beginning of Previous Log =====" "Error fetching previous logs: when opening the log stream: previous terminated container \"postgres\" in pod \"cluster-example-1\" not found" "====== End of Previous Log ====="
Code of Conduct
- I agree to follow this project's Code of Conduct