Files
eCommerce-backend/k8s/base/postgres-statefulset.yaml
2026-02-19 18:09:25 +05:30

60 lines
1.6 KiB
YAML

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres
namespace: ecommerce
labels:
app: postgres
spec:
serviceName: postgres
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
securityContext:
fsGroup: 999
containers:
- name: postgres
image: postgres:15-alpine
ports:
- containerPort: 5432
env:
- name: POSTGRES_DB
value: "vaishnavi_db"
- name: POSTGRES_USER
value: "vaishnavi"
- name: POSTGRES_PASSWORD
value: "admin"
- name: PGDATA
value: "/var/lib/postgresql/data/pgdata"
volumeMounts:
- name: postgres-data
mountPath: /var/lib/postgresql/data
resources:
requests:
cpu: "100m"
memory: "256Mi"
limits:
cpu: "500m"
memory: "512Mi"
readinessProbe:
exec:
command: [pg_isready, -U, vaishnavi, -d, vaishnavi_db]
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 6
livenessProbe:
exec:
command: [pg_isready, -U, vaishnavi, -d, vaishnavi_db]
initialDelaySeconds: 30
periodSeconds: 10
volumes:
- name: postgres-data
persistentVolumeClaim:
claimName: postgres-data