Created
November 18, 2016 16:45
-
-
Save georgewhewell/465ef92a690f3ad3c133a1228af229a1 to your computer and use it in GitHub Desktop.
postgres on gke with persistent volume
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: extensions/v1beta1 | |
| kind: Deployment | |
| metadata: | |
| labels: | |
| app: postgres-db | |
| name: postgres-db | |
| spec: | |
| replicas: 1 | |
| template: | |
| metadata: | |
| labels: | |
| app: postgres-db | |
| name: postgres-db | |
| spec: | |
| containers: | |
| - name: postgres-db | |
| image: postgres:9.6 | |
| imagePullPolicy: Always | |
| ports: | |
| - containerPort: 5432 | |
| volumeMounts: | |
| # Persist our configs in an SQLite DB in here | |
| - mountPath: /var/lib/postgresql/data | |
| name: postgres-data | |
| env: | |
| - name: PGDATA | |
| value: "/var/lib/postgresql/data/pgdata" | |
| - name: DB_PASS | |
| valueFrom: | |
| secretKeyRef: | |
| name: postgres-secrets | |
| key: db_pass | |
| volumes: | |
| - name: postgres-data | |
| gcePersistentDisk: | |
| pdName: postgres-data | |
| fsType: ext4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Secret | |
| metadata: | |
| name: postgres-secrets | |
| type: Opaque | |
| data: | |
| db_pass: cGdwYXNz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: postgres-db | |
| labels: | |
| app: postgres-db | |
| spec: | |
| type: NodePort | |
| ports: | |
| - port: 5432 | |
| protocol: TCP | |
| selector: | |
| app: postgres-db |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
now what if we had more than one node and need more than one replica?