117 lines
2.9 KiB
YAML
117 lines
2.9 KiB
YAML
|
|
---
|
||
|
|
# PostgreSQL PersistentVolumeClaim
|
||
|
|
apiVersion: v1
|
||
|
|
kind: PersistentVolumeClaim
|
||
|
|
metadata:
|
||
|
|
name: pangolin-postgres-data
|
||
|
|
namespace: pangolin
|
||
|
|
annotations:
|
||
|
|
argocd.argoproj.io/sync-options: Delete=false
|
||
|
|
spec:
|
||
|
|
accessModes:
|
||
|
|
- ReadWriteOnce
|
||
|
|
storageClassName: hcloud-volumes-encrypted
|
||
|
|
resources:
|
||
|
|
requests:
|
||
|
|
storage: 10Gi
|
||
|
|
---
|
||
|
|
# PostgreSQL Service (headless-friendly ClusterIP)
|
||
|
|
apiVersion: v1
|
||
|
|
kind: Service
|
||
|
|
metadata:
|
||
|
|
name: pangolin-postgres
|
||
|
|
namespace: pangolin
|
||
|
|
labels:
|
||
|
|
app: pangolin-postgres
|
||
|
|
spec:
|
||
|
|
type: ClusterIP
|
||
|
|
selector:
|
||
|
|
app: pangolin-postgres
|
||
|
|
ports:
|
||
|
|
- name: postgres
|
||
|
|
port: 5432
|
||
|
|
targetPort: 5432
|
||
|
|
protocol: TCP
|
||
|
|
---
|
||
|
|
# PostgreSQL Deployment (single-replica; PVC is RWO)
|
||
|
|
apiVersion: apps/v1
|
||
|
|
kind: Deployment
|
||
|
|
metadata:
|
||
|
|
name: pangolin-postgres
|
||
|
|
namespace: pangolin
|
||
|
|
labels:
|
||
|
|
app: pangolin-postgres
|
||
|
|
spec:
|
||
|
|
replicas: 1
|
||
|
|
strategy:
|
||
|
|
type: Recreate
|
||
|
|
selector:
|
||
|
|
matchLabels:
|
||
|
|
app: pangolin-postgres
|
||
|
|
template:
|
||
|
|
metadata:
|
||
|
|
labels:
|
||
|
|
app: pangolin-postgres
|
||
|
|
spec:
|
||
|
|
securityContext:
|
||
|
|
fsGroup: 999
|
||
|
|
containers:
|
||
|
|
- name: postgres
|
||
|
|
image: postgres:17.5
|
||
|
|
imagePullPolicy: IfNotPresent
|
||
|
|
ports:
|
||
|
|
- containerPort: 5432
|
||
|
|
name: postgres
|
||
|
|
env:
|
||
|
|
- name: POSTGRES_USER
|
||
|
|
valueFrom:
|
||
|
|
secretKeyRef:
|
||
|
|
name: pangolin-postgres-secrets
|
||
|
|
key: postgres-user
|
||
|
|
- name: POSTGRES_PASSWORD
|
||
|
|
valueFrom:
|
||
|
|
secretKeyRef:
|
||
|
|
name: pangolin-postgres-secrets
|
||
|
|
key: postgres-password
|
||
|
|
- name: POSTGRES_DB
|
||
|
|
valueFrom:
|
||
|
|
secretKeyRef:
|
||
|
|
name: pangolin-postgres-secrets
|
||
|
|
key: postgres-db
|
||
|
|
- name: PGDATA
|
||
|
|
value: /var/lib/postgresql/data/pgdata
|
||
|
|
volumeMounts:
|
||
|
|
- name: data
|
||
|
|
mountPath: /var/lib/postgresql/data
|
||
|
|
resources:
|
||
|
|
requests:
|
||
|
|
memory: "256Mi"
|
||
|
|
cpu: "100m"
|
||
|
|
limits:
|
||
|
|
memory: "1Gi"
|
||
|
|
cpu: "1000m"
|
||
|
|
readinessProbe:
|
||
|
|
exec:
|
||
|
|
command:
|
||
|
|
- /bin/sh
|
||
|
|
- -c
|
||
|
|
- pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB"
|
||
|
|
initialDelaySeconds: 10
|
||
|
|
periodSeconds: 5
|
||
|
|
timeoutSeconds: 3
|
||
|
|
failureThreshold: 6
|
||
|
|
livenessProbe:
|
||
|
|
exec:
|
||
|
|
command:
|
||
|
|
- /bin/sh
|
||
|
|
- -c
|
||
|
|
- pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB"
|
||
|
|
initialDelaySeconds: 30
|
||
|
|
periodSeconds: 10
|
||
|
|
timeoutSeconds: 5
|
||
|
|
failureThreshold: 6
|
||
|
|
volumes:
|
||
|
|
- name: data
|
||
|
|
persistentVolumeClaim:
|
||
|
|
claimName: pangolin-postgres-data
|