Repository navigation
Closed
Description
⚠️ The root cause of this issue was: #6761
If you are encountering this issue on the latest CNPG you may need to restart your instances manually for the instance manager upgrade to take effect.
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
Version
1.25 (latest patch)
What version of Kubernetes are you using?
1.29
What is your Kubernetes environment?
Cloud: Azure AKS
How did you install the operator?
YAML manifest
What happened?
Symptoms
- Any operations which require
/readyzor/pg/statusto respond fail /readyzand/pg/statushang after TLS handshake from inside and outside the podcnpg statushangs
Hanging endpoints
/readyz- logs a failurecontext cancelled/pg/status- logs a success -- but doesn't return a response
Working endpoints
/healthzworks/pg/controldataworks/pg/mode/backupworks/pg/archive/partialworks
Troubleshooting steps
- I have confirmed this via
curltolocalhostfrom inside the pod. - These endpoints established a TLS connection and then never respond.
- Other Controller Manager endpoints respond in a timely fashion
Slack thread
A full diagnostic Slack thread is available on CNPG slack here:
https://cloudnativepg.slack.com/archives/C03AX0J5P29/p1736880191821519
❯ kubectl exec -n db -it production-pg-etl-1 -- /bin/bash
Defaulted container "postgres" out of: postgres, bootstrap-controller (init)
postgres@production-pg-etl-1:/$ curl -kv https://localhost:8000/readyz
* Trying 127.0.0.1:8000...
* Connected to localhost (127.0.0.1) port 8000 (#0)
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN: server accepted h2
* Server certificate:
* subject: CN=production-pg-etl-rw
* start date: Jan 9 16:54:17 2025 GMT
* expire date: Apr 9 16:54:17 2025 GMT
* issuer: OU=db; CN=production-pg-etl
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* using HTTP/2
* h2h3 [:method: GET]
* h2h3 [:path: /readyz]
* h2h3 [:scheme: https]
* h2h3 [:authority: localhost:8000]
* h2h3 [user-agent: curl/7.88.1]
* h2h3 [accept: */*]
* Using Stream ID: 1 (easy handle 0x5641e939ece0)
> GET /readyz HTTP/2
> Host: localhost:8000
> user-agent: curl/7.88.1
> accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
Relevant Slack Thread:
https://cloudnativepg.slack.com/archives/C03AX0J5P29/p1736795638839879
Cluster resource
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
annotations:
cnpg.io/reconciliationLoop: disabled
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"postgresql.cnpg.io/v1","kind":"Cluster","metadata":{"annotations":{},"name":"production-pg-etl","namespace":"db"},"spec":{"affinity":{"nodeSelector":{"kubernetes.azure.com/agentpool":"pgetl2"},"tolerations":[{"effect":"NoSchedule","key":"node-role.kubernetes.io/postgres","operator":"Exists"}]},"backup":{"barmanObjectStore":{"azureCredentials":{"connectionString":{"key":"AZURE_STORAGE_CONNECTION_STRING","name":"postgres-backup-azure-creds"}},"data":{"compression":"snappy","jobs":16},"destinationPath":"https://gisualproduction.blob.core.windows.net/postgres-backup","wal":{"maxParallel":16}},"retentionPolicy":"30d","target":"prefer-standby","volumeSnapshot":{"className":"csi-azure-disk","online":true,"onlineConfiguration":{"immediateCheckpoint":false,"waitForArchive":true},"snapshotOwnerReference":"cluster"}},"bootstrap":{"initdb":{"database":"gisual","owner":"gisual","secret":{"name":"postgres-gisual-db-credentials"}}},"enablePDB":true,"enableSuperuserAccess":true,"env":[{"name":"ENABLE_AZURE_PVC_UPDATES","value":"true"},{"name":"ENABLE_INSTANCE_MANAGER_INPLACE_UPDATE","value":"true"}],"failoverDelay":30,"imageCatalogRef":{"apiGroup":"postgresql.cnpg.io","kind":"ImageCatalog","major":17,"name":"custom-postgres-images"},"imagePullSecrets":[{"name":"docker-registry-credentials"}],"instances":3,"monitoring":{"enablePodMonitor":true},"postgresql":{"parameters":{"autovacuum_max_workers":"2","autovacuum_naptime":"20s","autovacuum_vacuum_cost_limit":"1000","autovacuum_vacuum_scale_factor":"0.1","checkpoint_completion_target":"0.9","checkpoint_timeout":"15min","cron.database_name":"gisual","cron.use_background_workers":"on","default_statistics_target":"100","default_toast_compression":"lz4","effective_cache_size":"21366MB","effective_io_concurrency":"1000","idle_in_transaction_session_timeout":"30min","lock_timeout":"1800s","maintenance_work_mem":"1823232kB","max_connections":"100","max_parallel_maintenance_workers":"4","max_parallel_workers":"8","max_parallel_workers_per_gather":"4","max_wal_size":"4GB","max_worker_processes":"8","min_wal_size":"1GB","random_page_cost":"1.1","shared_buffers":"7122MB","statement_timeout":"7200s","wal_buffers":"16MB","wal_compression":"lz4","work_mem":"9116kB"},"shared_preload_libraries":["pg_stat_statements","auto_explain","pg_cron"]},"primaryUpdateStrategy":"unsupervised","resources":{"limits":{"cpu":"6858m","memory":"28488Mi"},"requests":{"cpu":"6858m","memory":"28488Mi"}},"storage":{"size":"1024Gi","storageClass":"12800-iops-290mb-tp-premium-v2"},"superuserSecret":{"name":"postgres-superuser-secret"},"switchoverDelay":30,"walStorage":{"size":"312Gi","storageClass":"12800-iops-290mb-tp-premium-v2"}}}
kubectl.kubernetes.io/restartedAt: "2025-01-11T19:57:48-05:00"
creationTimestamp: "2025-01-09T16:59:17Z"
generation: 6
name: production-pg-etl
namespace: db
resourceVersion: "890729746"
uid: 61049947-c1e9-49c3-a4b4-d0e81a463034
spec:
affinity:
nodeSelector:
kubernetes.azure.com/agentpool: pgetl2
podAntiAffinityType: preferred
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/postgres
operator: Exists
backup:
barmanObjectStore:
azureCredentials:
connectionString:
key: AZURE_STORAGE_CONNECTION_STRING
name: postgres-backup-azure-creds
data:
compression: snappy
jobs: 16
destinationPath: https://gisualproduction.blob.core.windows.net/postgres-backup
wal:
maxParallel: 16
retentionPolicy: 30d
target: prefer-standby
volumeSnapshot:
className: csi-azure-disk
online: true
onlineConfiguration:
immediateCheckpoint: false
waitForArchive: true
snapshotOwnerReference: cluster
bootstrap:
initdb:
database: gisual
encoding: UTF8
localeCType: C
localeCollate: C
owner: gisual
secret:
name: postgres-gisual-db-credentials
enablePDB: true
enableSuperuserAccess: true
env:
- name: ENABLE_AZURE_PVC_UPDATES
value: "true"
- name: ENABLE_INSTANCE_MANAGER_INPLACE_UPDATE
value: "true"
failoverDelay: 30
imageCatalogRef:
apiGroup: postgresql.cnpg.io
kind: ImageCatalog
major: 17
name: custom-postgres-images
imagePullSecrets:
- name: docker-registry-credentials
instances: 3
logLevel: info
maxSyncReplicas: 0
minSyncReplicas: 0
monitoring:
customQueriesConfigMap:
- key: queries
name: cnpg-default-monitoring
disableDefaultQueries: false
enablePodMonitor: true
postgresGID: 26
postgresUID: 26
postgresql:
parameters:
archive_mode: "on"
archive_timeout: 5min
autovacuum_max_workers: "2"
autovacuum_naptime: 20s
autovacuum_vacuum_cost_limit: "1000"
autovacuum_vacuum_scale_factor: "0.1"
checkpoint_completion_target: "0.9"
checkpoint_timeout: 15min
cron.database_name: gisual
cron.use_background_workers: "on"
default_statistics_target: "100"
default_toast_compression: lz4
dynamic_shared_memory_type: posix
effective_cache_size: 21366MB
effective_io_concurrency: "1000"
full_page_writes: "on"
idle_in_transaction_session_timeout: 30min
lock_timeout: 1800s
log_destination: csvlog
log_directory: /controller/log
log_filename: postgres
log_rotation_age: "0"
log_rotation_size: "0"
log_truncate_on_rotation: "false"
logging_collector: "on"
maintenance_work_mem: 1823232kB
max_connections: "100"
max_parallel_maintenance_workers: "4"
max_parallel_workers: "8"
max_parallel_workers_per_gather: "4"
max_replication_slots: "32"
max_wal_size: 4GB
max_worker_processes: "8"
min_wal_size: 1GB
random_page_cost: "1.1"
shared_buffers: 7122MB
shared_memory_type: mmap
shared_preload_libraries: ""
ssl_max_protocol_version: TLSv1.3
ssl_min_protocol_version: TLSv1.3
statement_timeout: 7200s
wal_buffers: 16MB
wal_compression: lz4
wal_keep_size: 512MB
wal_level: logical
wal_log_hints: "on"
wal_receiver_timeout: 5s
wal_sender_timeout: 5s
work_mem: 9116kB
shared_preload_libraries:
- pg_stat_statements
- auto_explain
- pg_cron
syncReplicaElectionConstraint:
enabled: false
primaryUpdateMethod: restart
primaryUpdateStrategy: unsupervised
replicationSlots:
highAvailability:
enabled: true
slotPrefix: _cnpg_
synchronizeReplicas:
enabled: true
updateInterval: 30
resources:
limits:
cpu: 6858m
memory: 28488Mi
requests:
cpu: 6858m
memory: 28488Mi
smartShutdownTimeout: 180
startDelay: 3600
stopDelay: 1800
storage:
resizeInUseVolumes: true
size: 1024Gi
storageClass: 12800-iops-290mb-tp-premium-v2
superuserSecret:
name: postgres-superuser-secret
switchoverDelay: 30
walStorage:
resizeInUseVolumes: true
size: 312Gi
storageClass: 12800-iops-290mb-tp-premium-v2
status:
availableArchitectures:
- goArch: amd64
hash: 58242fc95faa81d6bba0ba19ea959b82d9b49dc5f8e6c755f3c663665ff0ce1d
- goArch: arm64
hash: 8e5ef490a05bbd5700047edda5e2440acd14bafa256dbfcc7d4a5107573df75b
certificates:
clientCASecret: production-pg-etl-ca
expirations:
production-pg-etl-ca: 2025-04-09 16:54:17 +0000 UTC
production-pg-etl-replication: 2025-04-09 16:54:17 +0000 UTC
production-pg-etl-server: 2025-04-09 16:54:17 +0000 UTC
replicationTLSSecret: production-pg-etl-replication
serverAltDNSNames:
- production-pg-etl-rw
- production-pg-etl-rw.db
- production-pg-etl-rw.db.svc
- production-pg-etl-rw.db.svc.cluster.local
- production-pg-etl-r
- production-pg-etl-r.db
- production-pg-etl-r.db.svc
- production-pg-etl-r.db.svc.cluster.local
- production-pg-etl-ro
- production-pg-etl-ro.db
- production-pg-etl-ro.db.svc
- production-pg-etl-ro.db.svc.cluster.local
serverCASecret: production-pg-etl-ca
serverTLSSecret: production-pg-etl-server
cloudNativePGCommitHash: bad5a251
cloudNativePGOperatorHash: 58242fc95faa81d6bba0ba19ea959b82d9b49dc5f8e6c755f3c663665ff0ce1d
conditions:
- lastTransitionTime: "2025-01-13T04:32:48Z"
message: Cluster Is Not Ready
reason: ClusterIsNotReady
status: "False"
type: Ready
- lastTransitionTime: "2025-01-09T16:59:59Z"
message: Continuous archiving is working
reason: ContinuousArchivingSuccess
status: "True"
type: ContinuousArchiving
- lastTransitionTime: "2025-01-13T00:47:27Z"
message: 'while trying to start the backup: while executing http request: Post
"https://10.130.0.239:8000/pg/mode/backup": context deadline exceeded (Client.Timeout
exceeded while awaiting headers)'
reason: LastBackupFailed
status: "False"
type: LastBackupSucceeded
configMapResourceVersion:
metrics:
cnpg-default-monitoring: "824255109"
currentPrimary: production-pg-etl-1
currentPrimaryTimestamp: "2025-01-09T16:59:55.604522Z"
firstRecoverabilityPoint: "2025-01-09T17:08:15Z"
firstRecoverabilityPointByMethod:
barmanObjectStore: "2025-01-10T00:00:03Z"
volumeSnapshot: "2025-01-09T17:08:15Z"
healthyPVC:
- production-pg-etl-1
- production-pg-etl-1-wal
- production-pg-etl-4
- production-pg-etl-4-wal
- production-pg-etl-5
- production-pg-etl-5-wal
image: docker.gisual.net/custom-postgres17:17.2@sha256:9d93740c5fcfa7b3113815d6118f8a0afe35dcef38775dae2b93f6d7badedc91
instanceNames:
- production-pg-etl-1
- production-pg-etl-4
- production-pg-etl-5
instances: 3
instancesReportedState:
production-pg-etl-1:
isPrimary: true
timeLineID: 1
production-pg-etl-4:
isPrimary: false
production-pg-etl-5:
isPrimary: false
instancesStatus:
healthy:
- production-pg-etl-1
replicating:
- production-pg-etl-4
- production-pg-etl-5
lastFailedBackup: "2025-01-11T01:19:12Z"
lastSuccessfulBackup: "2025-01-13T00:47:13Z"
lastSuccessfulBackupByMethod:
barmanObjectStore: "2025-01-13T00:47:13Z"
volumeSnapshot: "2025-01-12T14:08:35Z"
latestGeneratedNode: 5
managedRolesStatus: {}
phase: Not enough disk space
phaseReason: Insufficient disk space detected in one or more pods is preventing
PostgreSQL from running.Please verify your storage settings. Further information
inside .status.instancesReportedState
poolerIntegrations:
pgBouncerIntegration: {}
pvcCount: 6
readService: production-pg-etl-r
readyInstances: 1
secretsResourceVersion:
clientCaSecretVersion: "882787408"
replicationSecretVersion: "882787410"
serverCaSecretVersion: "882787408"
serverSecretVersion: "882787409"
superuserSecretVersion: "824019503"
switchReplicaClusterStatus: {}
targetPrimary: production-pg-etl-1
targetPrimaryTimestamp: "2025-01-09T16:59:17.884407Z"
timelineID: 1
topology:
instances:
production-pg-etl-1: {}
production-pg-etl-4: {}
production-pg-etl-5: {}
nodesUsed: 3
successfullyExtracted: true
writeService: production-pg-etl-rwRelevant log output
{"level":"info","ts":"2025-01-13T20:08:15.41926761Z","msg":"Cannot extract Pod status","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"production-pg-common","namespace":"db"},"namespace":"db","name":"production-pg-common","reconcileID":"35929757-0e5a-4aa3-a21e-2dbaeaaf8cf7","podName":"production-pg-common-2","error":"Get \"https://10.130.18.19:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2025-01-13T20:08:45.697331048Z","msg":"Cannot extract Pod status","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"production-pg-common","namespace":"db"},"namespace":"db","name":"production-pg-common","reconcileID":"89849473-cf26-42ed-9b91-d5dfa7957ea3","podName":"production-pg-common-2","error":"Get \"https://10.130.18.19:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2025-01-13T20:09:15.849085431Z","msg":"Cannot extract Pod status","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"production-pg-common","namespace":"db"},"namespace":"db","name":"production-pg-common","reconcileID":"43c3444a-b204-4a3a-9b2f-bbe3b212e2bb","podName":"production-pg-common-2","error":"Get \"https://10.130.18.19:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2025-01-13T20:09:46.021972798Z","msg":"Cannot extract Pod status","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"production-pg-common","namespace":"db"},"namespace":"db","name":"production-pg-common","reconcileID":"7e42adf8-bea4-4eb3-b48c-1efdb88d0e8a","podName":"production-pg-common-2","error":"Get \"https://10.130.18.19:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2025-01-13T20:10:16.518873375Z","msg":"Cannot extract Pod status","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"production-pg-common","namespace":"db"},"namespace":"db","name":"production-pg-common","reconcileID":"1f0f5b0d-e3be-4a31-87ed-e3b202b94f69","podName":"production-pg-common-2","error":"Get \"https://10.130.18.19:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
triagePending triage
Type
Projects
- StatusShow more project fieldsDone
Activity
[-][Bug]: Controller Manager: /readyz and /pg/status endpoint hang indefinitely[/-][+][Bug]: Controller Manager: /readyz and /pg/status endpoint hang indefinitely (even inside container/pod)[/+]jmealo commentedon Jan 14, 2025
@sxd This issue is also reported here:
jmealo commentedon Jan 14, 2025
@sxn: Here's a compact Slack thread with the troubleshooting steps, I put the shell output/logs into a gist per step.
https://cloudnativepg.slack.com/archives/C03AX0J5P29/p1736880191821519
Cluster and operator reports with
--logsare available upon request.For my records, these are the filenames for those reports:
~/Desktop/CNPG-ISSUE-6599/report_cluster_staging-pg-common_2025-01-14T19:27:28Z.zip~/Desktop/CNPG-ISSUE-6599/report_operator_2025-01-14T19:27:47Z.zipardentperf commentedon Jan 15, 2025
discussed this issue on community call this morning
FYI - useful link - the readiness probe for the database pod itself is here
cloudnative-pg/pkg/management/postgres/webserver/remote.go
Lines 138 to 148 in 45a147b
Also cf logLevel setting in ClusterSpec; setting this to trace might be worth a try https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-ClusterSpec
jmealo commentedon Jan 15, 2025
I had
cnpg statusin awatch -n2window and noticed it stopped moving.Sure enough, my pod was not ready (but my workloads connected to the primary were still working fine).
New connections to the hostname failed (due to service health).
Requests to
/pg/statushang indefinitely (no headers/body), however, they log success.Requests to
/readyzhang indefinitely and log a failure.There is nothing useful in the logs, but, they're available upon request and are in the Slack thread.
jmealo commentedon Jan 27, 2025
Is there anything we can do to avoid forcing a failover to remedy this? Can we send a signal inside the pod to restart the web server?
jmealo commentedon Feb 4, 2025
One of the root causes have been identified: #6761
I haven't closed this issue because there are outstanding defects identified in the probes and connection/context/concurrency handling that need to be addressed.
jmealo commentedon Feb 17, 2025
If you encounter this issue:
pg_stat_activitychore(webserver,update): retrieve instance architecture using Go runt…
chore(webserver,update): retrieve instance architecture using Go runt…
chore(webserver,update): retrieve instance architecture using Go runt…
chore(webserver,update): retrieve instance architecture using Go runt…