87 lines
No EOL
2.2 KiB
YAML
87 lines
No EOL
2.2 KiB
YAML
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: postgres-aprs
|
|
namespace: aprs
|
|
spec:
|
|
selector:
|
|
app: postgres-aprs
|
|
ports:
|
|
- port: 5432
|
|
targetPort: 5432
|
|
type: ClusterIP
|
|
---
|
|
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
|
|
securityContext:
|
|
fsGroup: 999
|
|
fsGroupChangePolicy: OnRootMismatch
|
|
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
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
runAsNonRoot: true
|
|
runAsUser: 999
|
|
runAsGroup: 999
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
|
|
initialDelaySeconds: 60 # 1 minute to start
|
|
periodSeconds: 30 # Check every 30s
|
|
timeoutSeconds: 10 # 10s timeout for probe
|
|
failureThreshold: 3 # Allow 3 failures
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
|
|
initialDelaySeconds: 30 # 30 seconds to start
|
|
periodSeconds: 10 # Check every 10s
|
|
timeoutSeconds: 5 # 5s timeout for probe
|
|
failureThreshold: 3 # Allow 3 failures
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: postgres-storage
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: longhorn
|
|
resources:
|
|
requests:
|
|
storage: 256Gi |