anydrop/k8s/postgres.yml
ordinarthur 2913618ee6
Some checks failed
Build & Deploy / build-and-deploy (push) Failing after 1m47s
feat: stealth accounts + data layer (Phase 1)
2026-04-20 09:57:22 +02:00

85 lines
2.0 KiB
YAML

apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: anydrop
labels:
app: postgres
spec:
clusterIP: None
selector:
app: postgres
ports:
- name: postgres
port: 5432
targetPort: 5432
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres
namespace: anydrop
spec:
serviceName: postgres
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:16-alpine
ports:
- containerPort: 5432
name: postgres
env:
- name: POSTGRES_DB
value: anydrop
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-credentials
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-credentials
key: password
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
livenessProbe:
exec:
command: ["pg_isready", "-U", "anydrop", "-d", "anydrop"]
initialDelaySeconds: 30
periodSeconds: 15
timeoutSeconds: 5
readinessProbe:
exec:
command: ["pg_isready", "-U", "anydrop", "-d", "anydrop"]
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 3
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 5Gi