62 lines
1.5 KiB
YAML
62 lines
1.5 KiB
YAML
|
|
apiVersion: apps/v1
|
||
|
|
kind: StatefulSet
|
||
|
|
metadata:
|
||
|
|
name: postgres
|
||
|
|
labels:
|
||
|
|
app: postgres
|
||
|
|
spec:
|
||
|
|
serviceName: postgres
|
||
|
|
replicas: 1
|
||
|
|
selector:
|
||
|
|
matchLabels:
|
||
|
|
app: postgres
|
||
|
|
template:
|
||
|
|
metadata:
|
||
|
|
labels:
|
||
|
|
app: postgres
|
||
|
|
spec:
|
||
|
|
containers:
|
||
|
|
- name: postgres
|
||
|
|
image: postgres:13.16
|
||
|
|
imagePullPolicy: IfNotPresent
|
||
|
|
ports:
|
||
|
|
- name: postgres
|
||
|
|
containerPort: 5432
|
||
|
|
envFrom:
|
||
|
|
- configMapRef:
|
||
|
|
name: postgres-config
|
||
|
|
volumeMounts:
|
||
|
|
- name: postgres-data
|
||
|
|
mountPath: /var/lib/postgresql/data
|
||
|
|
readinessProbe:
|
||
|
|
exec:
|
||
|
|
command:
|
||
|
|
- sh
|
||
|
|
- -c
|
||
|
|
- pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB"
|
||
|
|
initialDelaySeconds: 8
|
||
|
|
periodSeconds: 5
|
||
|
|
timeoutSeconds: 3
|
||
|
|
failureThreshold: 12
|
||
|
|
livenessProbe:
|
||
|
|
exec:
|
||
|
|
command:
|
||
|
|
- sh
|
||
|
|
- -c
|
||
|
|
- pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB"
|
||
|
|
initialDelaySeconds: 30
|
||
|
|
periodSeconds: 20
|
||
|
|
timeoutSeconds: 3
|
||
|
|
failureThreshold: 3
|
||
|
|
resources:
|
||
|
|
requests:
|
||
|
|
cpu: 100m
|
||
|
|
memory: 256Mi
|
||
|
|
limits:
|
||
|
|
cpu: 500m
|
||
|
|
memory: 512Mi
|
||
|
|
volumes:
|
||
|
|
- name: postgres-data
|
||
|
|
persistentVolumeClaim:
|
||
|
|
claimName: postgres-data
|