Skip to content

Instantly share code, notes, and snippets.

@wolfeidau
Last active February 24, 2022 17:19
Show Gist options
  • Save wolfeidau/b55f321868ab6dac63f1 to your computer and use it in GitHub Desktop.
Save wolfeidau/b55f321868ab6dac63f1 to your computer and use it in GitHub Desktop.
PostrgreSQL running in kubernetes on google cloud with persistent disk
#
# PostgreSQL master for cohort demo application.
#
# gcloud compute disks create --size=200GB --zone=us-central1-c cohort-pg-master-data-disk
#
apiVersion: v1
kind: ReplicationController
metadata:
name: cohort-postgres
labels:
name: cohort-postgres
spec:
replicas: 1
selector:
name: cohort-postgres
template:
metadata:
labels:
name: cohort-postgres
spec:
containers:
- resources:
limits :
cpu: 0.1
image: postgres
name: postgres
env:
- name: DB_PASS
# change this
value: XXXX
ports:
- name: postgres
containerPort: 5432
hostPort: 5432
volumeMounts:
# name must match the volume name below
- name: postgres-persistent-storage
# mount path within the container
mountPath: /var/lib/postgresql
volumes:
- name: postgres-persistent-storage
gcePersistentDisk:
# This GCE PD must already exist.
pdName: cohort-pg-master-data-disk
fsType: ext4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment