kubectl create -f postgres-configmap.yaml
# configmap "postgres-config" created
Persistent Storage Volume
Create file with storage information postgres-storage.yaml:
kind: PersistentVolume
apiVersion: v1
metadata:
name: postgres-pv-volume
labels:
type: local
app: postgres
spec:
storageClassName: manual
capacity:
storage: 5Gi # Should be the same as in PersistentVolumeClaim
accessModes:
- ReadWriteMany
hostPath:
path: "/mnt/data" #
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: postgres-pv-claim
labels:
app: postgres
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi # Should be the same as in PersistentVolume
Creat Storage Volume:
kubectl create -f postgres-storage.yaml
# persistentvolume "postgres-pv-volume" created
# persistentvolumeclaim "postgres-pv-claim" created
PostgreSQL Deployment
postgres-deployment.yaml
Create file with deployment postgres-deployment.yaml: