feat(deploy): add pgbouncer poolers
This commit is contained in:
@@ -0,0 +1,203 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: pgbouncer
|
||||
labels:
|
||||
app.kubernetes.io/name: pgbouncer
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/name: pgbouncer
|
||||
ports:
|
||||
- name: postgres
|
||||
port: 5432
|
||||
targetPort: postgres
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: pgbouncer
|
||||
labels:
|
||||
app.kubernetes.io/name: pgbouncer
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: pgbouncer
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: pgbouncer
|
||||
spec:
|
||||
containers:
|
||||
- name: pgbouncer
|
||||
image: edoburu/pgbouncer:v1.24.1-p1
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: postgres
|
||||
containerPort: 5432
|
||||
env:
|
||||
- name: DB_HOST
|
||||
value: postgres
|
||||
- name: DB_PORT
|
||||
value: "5432"
|
||||
- name: DB_USER
|
||||
value: geo
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: geo-rankly-app-secret
|
||||
key: POSTGRES_PASSWORD
|
||||
- name: DB_NAME
|
||||
value: geo
|
||||
- name: AUTH_TYPE
|
||||
value: scram-sha-256
|
||||
- name: POOL_MODE
|
||||
value: session
|
||||
- name: MAX_CLIENT_CONN
|
||||
value: "200"
|
||||
- name: DEFAULT_POOL_SIZE
|
||||
value: "30"
|
||||
- name: MIN_POOL_SIZE
|
||||
value: "2"
|
||||
- name: RESERVE_POOL_SIZE
|
||||
value: "5"
|
||||
- name: RESERVE_POOL_TIMEOUT
|
||||
value: "5"
|
||||
- name: SERVER_IDLE_TIMEOUT
|
||||
value: "60"
|
||||
- name: SERVER_LIFETIME
|
||||
value: "1800"
|
||||
- name: SERVER_CONNECT_TIMEOUT
|
||||
value: "15"
|
||||
- name: CLIENT_LOGIN_TIMEOUT
|
||||
value: "15"
|
||||
- name: IGNORE_STARTUP_PARAMETERS
|
||||
value: extra_float_digits
|
||||
- name: ADMIN_USERS
|
||||
value: geo
|
||||
- name: STATS_USERS
|
||||
value: geo
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -ec
|
||||
- PGPASSWORD="${DB_PASSWORD}" psql -h 127.0.0.1 -p 5432 -U geo -d geo -c 'SELECT 1' >/dev/null
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 5
|
||||
livenessProbe:
|
||||
exec:
|
||||
command: ["pg_isready", "-h", "127.0.0.1", "-p", "5432", "-U", "geo", "-d", "geo"]
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 64Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 256Mi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: monitoring-pgbouncer
|
||||
labels:
|
||||
app.kubernetes.io/name: monitoring-pgbouncer
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/name: monitoring-pgbouncer
|
||||
ports:
|
||||
- name: postgres
|
||||
port: 5432
|
||||
targetPort: postgres
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: monitoring-pgbouncer
|
||||
labels:
|
||||
app.kubernetes.io/name: monitoring-pgbouncer
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: monitoring-pgbouncer
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: monitoring-pgbouncer
|
||||
spec:
|
||||
containers:
|
||||
- name: pgbouncer
|
||||
image: edoburu/pgbouncer:v1.24.1-p1
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: postgres
|
||||
containerPort: 5432
|
||||
env:
|
||||
- name: DB_HOST
|
||||
value: monitoring-postgres
|
||||
- name: DB_PORT
|
||||
value: "5432"
|
||||
- name: DB_USER
|
||||
value: geo
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: geo-rankly-app-secret
|
||||
key: POSTGRES_PASSWORD
|
||||
- name: DB_NAME
|
||||
value: geo_monitoring
|
||||
- name: AUTH_TYPE
|
||||
value: scram-sha-256
|
||||
- name: POOL_MODE
|
||||
value: session
|
||||
- name: MAX_CLIENT_CONN
|
||||
value: "200"
|
||||
- name: DEFAULT_POOL_SIZE
|
||||
value: "30"
|
||||
- name: MIN_POOL_SIZE
|
||||
value: "2"
|
||||
- name: RESERVE_POOL_SIZE
|
||||
value: "5"
|
||||
- name: RESERVE_POOL_TIMEOUT
|
||||
value: "5"
|
||||
- name: SERVER_IDLE_TIMEOUT
|
||||
value: "60"
|
||||
- name: SERVER_LIFETIME
|
||||
value: "1800"
|
||||
- name: SERVER_CONNECT_TIMEOUT
|
||||
value: "15"
|
||||
- name: CLIENT_LOGIN_TIMEOUT
|
||||
value: "15"
|
||||
- name: IGNORE_STARTUP_PARAMETERS
|
||||
value: extra_float_digits
|
||||
- name: ADMIN_USERS
|
||||
value: geo
|
||||
- name: STATS_USERS
|
||||
value: geo
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -ec
|
||||
- PGPASSWORD="${DB_PASSWORD}" psql -h 127.0.0.1 -p 5432 -U geo -d geo_monitoring -c 'SELECT 1' >/dev/null
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 5
|
||||
livenessProbe:
|
||||
exec:
|
||||
command: ["pg_isready", "-h", "127.0.0.1", "-p", "5432", "-U", "geo", "-d", "geo_monitoring"]
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 64Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 256Mi
|
||||
@@ -8,6 +8,7 @@ resources:
|
||||
- secrets.yaml
|
||||
- infra-postgres.yaml
|
||||
- infra-monitoring-postgres.yaml
|
||||
- infra-pgbouncer.yaml
|
||||
- infra-rabbitmq.yaml
|
||||
- infra-redis.yaml
|
||||
- infra-qdrant-minio.yaml
|
||||
|
||||
Reference in New Issue
Block a user