1
0
Fork 0
home-stack-kustomize/kustomize/bases/postgres/postgres-statefulset.yaml

75 lines
1.7 KiB
YAML
Raw Normal View History

2021-08-27 04:57:25 +00:00
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres
labels:
2021-12-27 00:11:38 +00:00
app.kubernetes.io/component: postgres
2021-08-27 04:57:25 +00:00
spec:
serviceName: postgres
selector:
matchLabels:
2021-12-27 00:11:38 +00:00
app.kubernetes.io/component: postgres
2021-08-27 04:57:25 +00:00
replicas: 1
template:
metadata:
labels:
2021-12-27 00:11:38 +00:00
app.kubernetes.io/component: postgres
2021-08-27 04:57:25 +00:00
spec:
containers:
- name: postgres
image: postgres
env:
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
2021-08-28 03:54:21 +00:00
name: postgres-credentials
2021-08-27 04:57:25 +00:00
key: database
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
2021-08-28 03:54:21 +00:00
name: postgres-credentials
2021-08-27 04:57:25 +00:00
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
2021-08-28 03:54:21 +00:00
name: postgres-credentials
2021-08-27 04:57:25 +00:00
key: password
- name: PGDATA
value: /data/pgdata
ports:
- name: postgres
containerPort: 5432
resources:
requests:
2021-12-29 19:51:26 +00:00
cpu: 500m
2021-08-28 03:54:21 +00:00
memory: 1Gi
limits:
2022-05-26 03:43:44 +00:00
cpu: 500m
memory: 1Gi
2021-08-27 04:57:25 +00:00
volumeMounts:
- name: postgres-pvc
mountPath: /data
volumeClaimTemplates:
- metadata:
name: postgres-pvc
spec:
2021-08-28 03:54:21 +00:00
accessModes:
- ReadWriteOnce
2021-08-27 04:57:25 +00:00
resources:
requests:
2021-08-27 19:57:29 +00:00
storage: 3Gi
2021-08-27 04:57:25 +00:00
---
apiVersion: v1
kind: Service
metadata:
name: postgres
labels:
app.kubernetes.io/name: postgres
spec:
selector:
app.kubernetes.io/name: postgres
ports:
- name: postgres
port: 5432
2021-08-28 03:54:21 +00:00
targetPort: postgres