You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
> [Postgres connection pool on Kubernetes in 1 minute](https://jmrobles.medium.com/postgres-connection-pool-on-kubernetes-in-1-minute-80b8020315ef)
201
+
202
+
First we create a _Config Map_ for the following values:
203
+
204
+
- `DB_HOST`: DNS hostname of our PostgreSQL service
205
+
- `DB_USER`: PostgreSQL database user
206
+
207
+
`DB_PASSWORD` will be set using the previously created secret. `POOL_MODE` is set to `transaction` and `SERVER_RESET_QUERY` to `DISCARD ALL` by default in the respective deployment manifest.
Now we can apply our deployment for [PgBouncer](https://www.pgbouncer.org/) that is based on this [Docker image](https://hub.docker.com/r/edoburu/pgbouncer/) for PgBouncer 1.15.0.
If you don't see acommand prompt, try pressing enter.
233
+
pgbouncer=# \x
234
+
Expanded display is on.
235
+
236
+
pgbouncer=# SHOW SERVERS;
237
+
-[ RECORD 1 ]+------------------------
238
+
type| S
239
+
user| postgres
240
+
database| postgres
241
+
state| used
242
+
addr| 172.17.0.5
243
+
port| 5432
244
+
local_addr| 172.17.0.6
245
+
local_port| 59960
246
+
connect_time| 2021-08-04 11:25:19 UTC
247
+
request_time| 2021-08-04 11:25:59 UTC
248
+
wait| 0
249
+
wait_us| 0
250
+
close_needed| 0
251
+
ptr| 0x7fa02cb54100
252
+
link|
253
+
remote_pid| 183
254
+
tls|
255
+
256
+
pgbouncer=# \q
257
+
pod"pg-psql" deleted
258
+
```
259
+
260
+
As we can so see PgBouncer only detects one server so far. The reason for that is, each server is listening on the same host and port. We need to fix that.