60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
namespace: portfolio
|
|
name: postgres-deployment
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: postgres
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: postgres
|
|
spec:
|
|
containers:
|
|
- name: postgres
|
|
image: postgres:14-bullseye
|
|
imagePullPolicy: "IfNotPresent"
|
|
ports:
|
|
- containerPort: 5432
|
|
env:
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgres-secret
|
|
key: postgresPassword
|
|
|
|
- name: POSTGRES_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgres-secret
|
|
key: postgresUser
|
|
|
|
- name: POSTGRES_DB
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgres-secret
|
|
key: postgresDatabase
|
|
volumeMounts:
|
|
- mountPath: /var/lib/postgresql/data
|
|
name: postgredb
|
|
volumes:
|
|
- name: postgredb
|
|
persistentVolumeClaim:
|
|
claimName: postgres-pv-claim
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
namespace: portfolio
|
|
name: postgres-service
|
|
spec:
|
|
selector:
|
|
app: postgres
|
|
ports:
|
|
- port: 5432
|
|
protocol: TCP
|
|
targetPort: 5432
|
|
type: ClusterIP |