Skip to content

Commit 14f058f

Browse files
committed
[postgres] Check pgbouncer liveness with internal sql command
A socket liveness probe seems to kill the pod, if the pooled db is down. But the idea is, that the pgbouncer should pause the connections until the db is back. Switching to query the stats seems to do the trick
1 parent 0b53d1b commit 14f058f

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

postgres/templates/pgbouncer-deployment.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,19 @@ spec:
4242
- name: LISTEN_PORT
4343
value: "6543"
4444
- name: MAX_CLIENT_CONN
45-
value: "{{.Values.pgbouncer.max_client_conn | .Values.global.pgbouncer.max_client_conn | default 16384 }}"
45+
value: "{{.Values.pgbouncer.max_client_conn | default .Values.global.pgbouncer.max_client_conn | default 16384 }}"
4646
- name: MIN_POOL_SIZE
47-
value: "{{.Values.pgbouncer.min_pool_size | .Values.global.pgbouncer.min_pool_size | default 1 }}"
47+
value: "{{.Values.pgbouncer.min_pool_size | default .Values.global.pgbouncer.min_pool_size | default 1 }}"
4848
- name: DEFAULT_POOL_SIZE
49-
value: "{{.Values.pgbouncer.default_pool_size | .Values.global.pgbouncer.default_pool_size | default 4 }}"
49+
value: "{{.Values.pgbouncer.default_pool_size | default .Values.global.pgbouncer.default_pool_size | default 4 }}"
5050
- name: RESERVE_POOL_SIZE
51-
value: "{{.Values.pgbouncer.reserve_pool_size | .Values.global.pgbouncer.reserve_pool_size | default 1024 }}"
51+
value: "{{.Values.pgbouncer.reserve_pool_size | default .Values.global.pgbouncer.reserve_pool_size | default 1024 }}"
52+
- name: STATS_PASS
53+
value: "{{.Values.pgbouncer.stats_pass | default .Values.global.pgbouncer.stats_pass | default (derivePassword 1 "long" "password" "stats_user" (print "postgres-" .Values.name "." .Release.Namespace ".svc.kubernetes." .Values.global.region "." .Values.global.tld)) }}"
5254
livenessProbe:
53-
tcpSocket:
54-
port: pgbouncer
55+
exec:
56+
command:
57+
- pgbouncer-k8s-liveness
5558
initialDelaySeconds: 1
5659
periodSeconds: 5
5760
failureThreshold: 3

0 commit comments

Comments
 (0)