K8S: PostgreSQL with Persistent Storage Volume
ConfigMap for PostgreSQL Configurations
Create file with configuration postgres-configmap.yaml:
Creat ConfigMap:
kubectl create -f postgres-configmap.yaml
# configmap "postgres-config" created
Persistent Storage Volume
Create file with storage information postgres-storage.yaml:
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:
Deploy:
kubectl create -f postgres-deployment.yaml
# deployment "postgres" created
Expose PostgreSQL
postgres-deployment.yaml Create service postgres-service.yaml:
Create Service:
kubectl create -f postgres-service.yaml
# service "postgres" created