Repository navigation
Closed as duplicate
Closed as duplicate
Copy link
Labels
triagePending triage
Description
⚠️ The root cause of this issue was: #6761
Upgrading to the latest CNPG should address this issue -- if it does not, you may need to manually restart your instances as the instance manager upgrade will fail if your connections are exhausted.
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.24.0
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?
kubectl cnpg statushangs indefinitely- metrics for the primary are incomplete/unavailable
I expect if the primary is healthy, accepting connections, and in a good state that the readiness probe will succeed.
Cluster resource
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"postgresql.cnpg.io/v1","kind":"Cluster","metadata":{"annotations":{},"name":"production-pg-common","namespace":"db"},"spec":{"affinity":{"nodeSelector":{"kubernetes.azure.com/agentpool":"pgcommon","kubernetes.io/arch":"arm64"},"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":2},"destinationPath":"https://gisualproduction.blob.core.windows.net/postgres-backup","wal":{"maxParallel":2}},"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"}],"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","default_statistics_target":"100","effective_cache_size":"4191MB","effective_io_concurrency":"1000","idle_in_transaction_session_timeout":"30min","jit":"off","lock_timeout":"1800s","maintenance_work_mem":"341MB","max_connections":"100","max_parallel_maintenance_workers":"2","max_parallel_workers":"4","max_parallel_workers_per_gather":"2","max_wal_size":"4GB","max_worker_processes":"4","min_wal_size":"1GB","random_page_cost":"1.1","shared_buffers":"1397MB","statement_timeout":"7200s","wal_buffers":"16MB","wal_compression":"lz4","work_mem":"4988kB"}},"primaryUpdateStrategy":"unsupervised","resources":{"limits":{"cpu":"2628m","memory":"5458Mi"},"requests":{"cpu":"2628m","memory":"5458Mi"}},"storage":{"size":"258Gi","storageClass":"6400-iops-212mb-tp-premium-v2"},"superuserSecret":{"name":"postgres-superuser-secret"},"switchoverDelay":30,"walStorage":{"size":"96Gi","storageClass":"6400-iops-212mb-tp-premium-v2"}}}
kubectl.kubernetes.io/restartedAt: "2024-12-11T14:01:24-05:00"
creationTimestamp: "2024-12-10T22:08:24Z"
generation: 5
name: production-pg-common
namespace: db
resourceVersion: "840866221"
uid: f02e579d-1d49-4cc2-ac9f-81a43fb28fe9
spec:
affinity:
nodeSelector:
kubernetes.azure.com/agentpool: pgcommon
kubernetes.io/arch: arm64
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: 2
destinationPath: https://xxxx.blob.core.windows.net/postgres-backup
wal:
maxParallel: 2
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"
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
default_statistics_target: "100"
dynamic_shared_memory_type: posix
effective_cache_size: 4191MB
effective_io_concurrency: "1000"
full_page_writes: "on"
idle_in_transaction_session_timeout: 30min
jit: "off"
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: 341MB
max_connections: "100"
max_parallel_maintenance_workers: "2"
max_parallel_workers: "4"
max_parallel_workers_per_gather: "2"
max_replication_slots: "32"
max_wal_size: 4GB
max_worker_processes: "4"
min_wal_size: 1GB
random_page_cost: "1.1"
shared_buffers: 1397MB
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: 4988kB
syncReplicaElectionConstraint:
enabled: false
primaryUpdateMethod: restart
primaryUpdateStrategy: unsupervised
replicationSlots:
highAvailability:
enabled: true
slotPrefix: _cnpg_
synchronizeReplicas:
enabled: true
updateInterval: 30
resources:
limits:
cpu: 2628m
memory: 5458Mi
requests:
cpu: 2628m
memory: 5458Mi
smartShutdownTimeout: 180
startDelay: 3600
stopDelay: 1800
storage:
resizeInUseVolumes: true
size: 258Gi
storageClass: 6400-iops-212mb-tp-premium-v2
superuserSecret:
name: postgres-superuser-secret
switchoverDelay: 30
walStorage:
resizeInUseVolumes: true
size: 96Gi
storageClass: 6400-iops-212mb-tp-premium-v2
status:
availableArchitectures:
- goArch: amd64
hash: 575b8d5080a718a1b1c8e6febcb6ccfde6cf546aa1a253acd7336226494ba784
- goArch: arm64
hash: bab50cc05e920db8bd118118323ef8003201dd3ba0642bbdee87cfdde1672e3e
certificates:
clientCASecret: production-pg-common-ca
expirations:
production-pg-common-ca: 2025-03-10 22:03:24 +0000 UTC
production-pg-common-replication: 2025-03-10 22:03:24 +0000 UTC
production-pg-common-server: 2025-03-10 22:03:24 +0000 UTC
replicationTLSSecret: production-pg-common-replication
serverAltDNSNames:
- production-pg-common-rw
- production-pg-common-rw.db
- production-pg-common-rw.db.svc
- production-pg-common-rw.db.svc.cluster.local
- production-pg-common-r
- production-pg-common-r.db
- production-pg-common-r.db.svc
- production-pg-common-r.db.svc.cluster.local
- production-pg-common-ro
- production-pg-common-ro.db
- production-pg-common-ro.db.svc
- production-pg-common-ro.db.svc.cluster.local
serverCASecret: production-pg-common-ca
serverTLSSecret: production-pg-common-server
cloudNativePGCommitHash: 3f96930d
cloudNativePGOperatorHash: 575b8d5080a718a1b1c8e6febcb6ccfde6cf546aa1a253acd7336226494ba784
conditions:
- lastTransitionTime: "2024-12-11T21:37:17Z"
message: Cluster is Ready
reason: ClusterIsReady
status: "True"
type: Ready
- lastTransitionTime: "2024-12-11T18:38:35Z"
message: Continuous archiving is working
reason: ContinuousArchivingSuccess
status: "True"
type: ContinuousArchiving
- lastTransitionTime: "2024-12-18T20:00:00Z"
message: 'Failed to create snapshot: failed to take snapshot of the volume /subscriptions/19ea338e-67f7-4a2f-a165-6ccdb9c1aecb/resourceGroups/mc_application_production-app-cluster_eastus/providers/Microsoft.Compute/disks/pvc-44483902-6492-4bb0-a1e9-3a4fd791a6da:
"rpc error: code = DeadlineExceeded desc = context deadline exceeded"'
reason: LastBackupFailed
status: "False"
type: LastBackupSucceeded
configMapResourceVersion:
metrics:
cnpg-default-monitoring: "824255109"
currentPrimary: production-pg-common-3
currentPrimaryTimestamp: "2024-12-11T18:38:32.062347Z"
firstRecoverabilityPoint: "2024-12-11T00:03:28Z"
firstRecoverabilityPointByMethod:
barmanObjectStore: "2024-12-11T00:03:28Z"
volumeSnapshot: "2024-12-11T00:09:40Z"
healthyPVC:
- production-pg-common-1
- production-pg-common-1-wal
- production-pg-common-2
- production-pg-common-2-wal
- production-pg-common-3
- production-pg-common-3-wal
image: docker.xxxxx.net/custom-postgres17:17.2@sha256:9d93740c5fcfa7b3113815d6118f8a0afe35dcef38775dae2b93f6d7badedc91
instanceNames:
- production-pg-common-1
- production-pg-common-2
- production-pg-common-3
instances: 3
instancesReportedState:
production-pg-common-1:
isPrimary: false
production-pg-common-2:
isPrimary: false
timeLineID: 2
production-pg-common-3:
isPrimary: true
timeLineID: 2
instancesStatus:
healthy:
- production-pg-common-2
- production-pg-common-3
replicating:
- production-pg-common-1
lastSuccessfulBackup: "2024-12-18T19:04:26Z"
lastSuccessfulBackupByMethod:
barmanObjectStore: "2024-12-18T00:08:10Z"
volumeSnapshot: "2024-12-18T19:04:26Z"
latestGeneratedNode: 3
managedRolesStatus: {}
phase: Cluster in healthy state
poolerIntegrations:
pgBouncerIntegration:
secrets:
- production-pg-common-pooler
pvcCount: 6
readService: production-pg-common-r
readyInstances: 2
secretsResourceVersion:
clientCaSecretVersion: "824255069"
replicationSecretVersion: "824255071"
serverCaSecretVersion: "824255069"
serverSecretVersion: "824255070"
superuserSecretVersion: "824019503"
switchReplicaClusterStatus: {}
targetPrimary: production-pg-common-3
targetPrimaryTimestamp: "2024-12-11T18:54:08.404015Z"
timelineID: 2
topology:
instances:
production-pg-common-1: {}
production-pg-common-2: {}
production-pg-common-3: {}
nodesUsed: 3
successfullyExtracted: true
writeService: production-pg-common-rwRelevant log output
{"level":"info","ts":"2024-12-18T20:36:42.6804172Z","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":"38dde046-8bac-4f48-9bbc-5421c9dd5f2d","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:37:12.829048134Z","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":"8b7b8a51-4b6b-4c3a-a329-6ee62ed434d3","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:37:42.97729912Z","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":"893e6af2-d47e-47af-818b-2b8491975a9d","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:38:13.142224766Z","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":"8f044ee3-d748-4528-b331-036f28e5833f","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:38:43.301316301Z","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":"fd50d828-3db8-40f1-8a42-3c95481c8f2d","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:39:13.447363434Z","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":"3eb4044e-a601-482a-8faf-77b3223ca777","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:39:43.601544485Z","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":"8db8ce61-c501-4743-8481-5f3db60d30b4","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:40:13.751990604Z","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":"3eab9855-a206-40f3-b739-ee2484fef421","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:40:43.911698484Z","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":"576818f3-1b02-49d4-bc5f-3d23d3611d0d","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:41:14.076655739Z","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":"d44b95cd-97c6-45d5-a28c-12a462d35d41","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:41:44.230566662Z","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":"f173c087-b924-44ed-b2f3-94d486be1e61","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:42:14.383416658Z","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":"71b1ba94-9a21-44e8-89b0-7b2323264f5d","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:42:44.547937354Z","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":"c64dc793-fdf0-4a0c-8040-759cedc2a232","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:43:14.709137225Z","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":"7511caa7-4838-4968-85f7-7b0be3e8d9c3","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:43:44.8918728Z","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":"1aaab653-b4e2-4f6b-9813-e509451f65a5","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:44:15.055810219Z","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":"25d90f69-e135-4d56-8d92-97aeb52037c0","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:44:45.215848484Z","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":"cb85b375-4b0f-40b2-ab0d-c504de9f67bf","name":"production-pg-common-1","error":"Get \"https://10.130.18.37:8000/pg/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
{"level":"info","ts":"2024-12-18T20:45:15.367350072Z","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":"58dbac9a-84fd-4573-a895-45fb2ab9d462","name":"production-pg-common-1","error":"Get \"https://10.130.18.37: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
Activity
usiegj00 commentedon Dec 23, 2024
Out of curiosity--can you access the primary pod and run psql in an exec'd shell on the container? If so, can you check whether the pg_database_size query is running (and continues to run indefinitely with the same PID)? And guessing the db is using a substantial amount of the 258Gi? (Check with
df -has the pg_database_size query is likely timing out.)We saw this on 1.23.4. The same issue exists in 1.24.0 where the status probe calls pg_database_size and does not return in time to show readiness (e.g. /pg/status failing). If you can still access the service locally with psql, then it's the probe's failure, not the database failing. Even if you try to upgrade to 1.24.1, you'll likely see the cluster will not upgrade because it is not healthy. We have an ugly workaround that has worked for every instance we've encountered. Happy to share it if you have the same isssue--confirmed with the outputs from the above check.
jmealo commentedon Jan 7, 2025
@usiegj00: Sorry just saw your post now.
pg_database_sizequery was running.I haven't tried upgrading the operator yet. I may need that workaround.
jmealo commentedon Jan 7, 2025
@gbartolini This is one of the more troubling bugs we're seeing frequently. It's alarming that it can cause many operations of the operator to fail, as it thinks the cluster is in a bad state.
usiegj00 commentedon Jan 7, 2025
@jmealo -- the ugly workaround goes like this:
pg_database_sizeis taking too long. Verify with the query above.pg_database_sizequeries with dummies that return 1 immediately. For example, psql on the master node and run the create or replace below.search_path = 'public, pg_catalog'(see below).SELECT pg_reload_conf();SHOW search_path; -- should show "public, pg_catalog"SELECT pg_database_size('mydb'); -- should now return 1pg_terminate_backend.pg_database_sizefunctions.Replacement Queries
Edit custom.conf
Remove the Queries
ardentperf commentedon Jan 12, 2025
@usiegj00 is the readiness probe not explicitly setting search_path? this seems potentially insecure... typically these sorts of injections shouldn't be allowed
cf. https://github.com/timescale/pgspot for a nice list of best practices here
ardentperf commentedon Jan 12, 2025
readiness probe will never be perfect, and is also pretty critical. i would suggest our focus should be on debuggability - if a readiness probe fails, what additional information would give more clarity?
if this is a timeout-based thing where k8s fails the check if it doesn't respond within some time threshold then there absolutely should be a metric by default on whatever number k8s is looking at to make that decision
based on the comment here about pg_database_size taking too long, another troubleshooting idea we might consider is enabling SQL tracing for the readiness probes with log_min_duration_statement=0 for that connection only
then you could check logs to see how long the queries for this session are taking
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.