41 lines
No EOL
1 KiB
YAML
41 lines
No EOL
1 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: postgres-deployment
|
|
spec:
|
|
replicas: 2
|
|
selector:
|
|
matchLabels:
|
|
app: postgres
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: postgres
|
|
spec:
|
|
containers:
|
|
- name: postgres
|
|
image: "postgres:16"
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- containerPort: 5432
|
|
envFrom:
|
|
- configMapRef:
|
|
name: postgres-db-details
|
|
env:
|
|
- name: POSTGRES_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: db-credentials
|
|
key: username
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: db-credentials
|
|
key: password
|
|
volumeMounts:
|
|
- mountPath: /var/lib/postgresql/data
|
|
name: postgresdata
|
|
volumes:
|
|
- name: postgresdata
|
|
persistentVolumeClaim:
|
|
claimName: postgres-volume-claim |