spring-web-modules/k8s/04-postgres.yaml
Sambo Chea 32c59a69f2
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Add k8s for spring web api
2022-04-11 10:15:20 +07:00

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