74 lines
No EOL
1.9 KiB
YAML
74 lines
No EOL
1.9 KiB
YAML
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: postgres-aprs
|
|
namespace: aprs
|
|
spec:
|
|
selector:
|
|
app: postgres-aprs
|
|
ports:
|
|
- port: 5432
|
|
targetPort: 5432
|
|
clusterIP: None
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: postgres-aprs
|
|
namespace: aprs
|
|
spec:
|
|
serviceName: postgres-aprs
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: postgres-aprs
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: postgres-aprs
|
|
spec:
|
|
terminationGracePeriodSeconds: 600 # 10 minutes to shutdown gracefully
|
|
containers:
|
|
- name: postgres
|
|
image: postgis/postgis:17-3.4
|
|
ports:
|
|
- containerPort: 5432
|
|
envFrom:
|
|
- secretRef:
|
|
name: postgres-aprs-secret
|
|
env:
|
|
- name: PGDATA
|
|
value: /var/lib/postgresql/data/pgdata
|
|
volumeMounts:
|
|
- name: postgres-storage
|
|
mountPath: /var/lib/postgresql/data
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
|
|
initialDelaySeconds: 300 # 5 minutes to start
|
|
periodSeconds: 30 # Check every 30s
|
|
timeoutSeconds: 10 # 10s timeout for probe
|
|
failureThreshold: 20 # Allow 20 failures (10 minutes)
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
|
|
initialDelaySeconds: 300 # 5 minutes to start
|
|
periodSeconds: 30 # Check every 30s
|
|
timeoutSeconds: 10 # 10s timeout for probe
|
|
failureThreshold: 20 # Allow 20 failures (10 minutes)
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: postgres-storage
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: longhorn
|
|
resources:
|
|
requests:
|
|
storage: 100Gi |