57 lines
1.3 KiB
YAML
57 lines
1.3 KiB
YAML
|
apiVersion: v1
|
||
|
kind: Service
|
||
|
metadata:
|
||
|
namespace: spring-web-dev
|
||
|
name: postgres-service
|
||
|
spec:
|
||
|
selector:
|
||
|
app: postgres
|
||
|
ports:
|
||
|
- port: 5432
|
||
|
targetPort: 5432
|
||
|
---
|
||
|
apiVersion: apps/v1
|
||
|
kind: Deployment
|
||
|
metadata:
|
||
|
namespace: spring-web-dev
|
||
|
name: postgres-deployment
|
||
|
spec:
|
||
|
selector:
|
||
|
matchLabels:
|
||
|
app: postgres
|
||
|
template:
|
||
|
metadata:
|
||
|
labels:
|
||
|
app: postgres
|
||
|
spec:
|
||
|
containers:
|
||
|
- name: postgres
|
||
|
image: postgres:alpine
|
||
|
ports:
|
||
|
- containerPort: 5432
|
||
|
env:
|
||
|
- name: POSTGRES_DB
|
||
|
valueFrom:
|
||
|
secretKeyRef:
|
||
|
name: spring-web-dev-secret
|
||
|
key: POSTGRES_DB
|
||
|
- name: POSTGRES_PASSWORD
|
||
|
valueFrom:
|
||
|
secretKeyRef:
|
||
|
name: spring-web-dev-secret
|
||
|
key: POSTGRES_PASSWORD
|
||
|
volumeMounts:
|
||
|
- name: postgres-data
|
||
|
mountPath: /var/lib/postgresql/data
|
||
|
subPath: postgresql-data
|
||
|
resources:
|
||
|
requests:
|
||
|
cpu: 100m
|
||
|
memory: 100Mi
|
||
|
limits:
|
||
|
cpu: 200m
|
||
|
memory: 200Mi
|
||
|
volumes:
|
||
|
- name: postgres-data
|
||
|
persistentVolumeClaim:
|
||
|
claimName: spring-web-dev-volume
|