zkt21/z2/postgres-deployment.yaml

53 lines
987 B
YAML
Raw Normal View History

2021-04-18 11:21:46 +00:00
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
service: postgres
name: postgres
spec:
replicas: 1
selector:
matchLabels:
service: postgres
strategy:
type: Recreate
template:
metadata:
labels:
service: postgres
spec:
containers:
- env:
- name: POSTGRES_HOST_AUTH_METHOD
value: trust
image: postgres:latest
name: postgres
ports:
- containerPort: 5432
resources: {}
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: db-data
restartPolicy: Always
volumes:
- name: db-data
persistentVolumeClaim:
claimName: db-data
status: {}
---
apiVersion: v1
kind: Service
metadata:
labels:
service: postgres
name: postgres
spec:
ports:
- name: "5432"
port: 5432
targetPort: 5432
selector:
service: postgres
status:
loadBalancer: {}