You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.5 KiB

apiVersion: v1
kind: Service
metadata:
name: statping-postgres
labels:
app: statping
spec:
ports:
- port: 5432
selector:
app: statping
tier: postgres
clusterIP: None
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pv-claim
labels:
app: statping
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: statping-postgres
labels:
app: statping
spec:
selector:
matchLabels:
app: statping
tier: postgres
strategy:
type: Recreate
template:
metadata:
labels:
app: statping
tier: postgres
spec:
containers:
- image: postgres:15.1
name: postgres
env:
- name: POSTGRES_USER
value: statping
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-pass
key: password
ports:
- containerPort: 5432
name: postgres
volumeMounts:
- name: postgres-persistent-storage
mountPath: /var/lib/postgresql/data
- name: host-mount
mountPath: /initdb
volumes:
- name: host-mount
hostPath:
path: /k8s/statping/initdb
- name: postgres-persistent-storage
persistentVolumeClaim:
claimName: postgres-pv-claim