-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeployment-pgbouncer.yaml
73 lines (72 loc) · 1.88 KB
/
deployment-pgbouncer.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
apiVersion: apps/v1
kind: Deployment
metadata:
name: pgbouncer
namespace: default
labels:
tier: pgbouncer
spec:
replicas: 1
selector:
matchLabels:
app: pgbouncer
template:
metadata:
labels:
app: pgbouncer
spec:
restartPolicy: Always
terminationGracePeriodSeconds: 60
serviceAccountName: cloud-sql-proxy
containers:
- name: pgbouncer
image: edoburu/pgbouncer:1.15.0
env:
- name: DB_HOST
value: "127.0.0.1"
- name: DB_PORT
value: "5431"
- name: DB_USER
valueFrom:
secretKeyRef:
name: cloud-sql-creds
key: username
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: cloud-sql-creds
key: password
ports:
- containerPort: 5432
protocol: TCP
readinessProbe:
tcpSocket:
port: 5432
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 5432
initialDelaySeconds: 15
periodSeconds: 20
lifecycle:
preStop:
exec:
# Allow existing queries clients to complete within 120 seconds
command: ["/bin/sh", "-c", "killall -INT pgbouncer && sleep 120"]
resources:
limits:
memory: "2Gi"
cpu: "1"
- name: cloud-sql-proxy
image: gcr.io/cloudsql-docker/gce-proxy:1.28.0
command:
- "/cloud_sql_proxy"
- "-ip_address_types=PRIVATE"
- "-instances=<INSTANCE_CONNECTION_NAME>=tcp:127.0.0.1:5431"
securityContext:
runAsNonRoot: true
resources:
limits:
memory: "2Gi"
cpu: "1"