Created
August 17, 2018 00:41
-
-
Save saden1/12afa2c8804c4310513545d71bac6596 to your computer and use it in GitHub Desktop.
Complete Kubernetes Postgres DB Spec
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: PersistentVolume | |
| metadata: | |
| name: postgres-pv | |
| labels: | |
| type: local | |
| spec: | |
| storageClassName: manual | |
| capacity: | |
| storage: 5Gi | |
| accessModes: | |
| - ReadWriteOnce | |
| hostPath: | |
| path: "/tmp/postgress-pv" | |
| type: DirectoryOrCreate | |
| --- | |
| apiVersion: v1 | |
| kind: PersistentVolumeClaim | |
| metadata: | |
| name: postgres-pvc | |
| labels: | |
| type: local | |
| spec: | |
| storageClassName: manual | |
| accessModes: | |
| - ReadWriteOnce | |
| volumeName: postgres-pv | |
| resources: | |
| requests: | |
| storage: 2Gi | |
| --- | |
| apiVersion: v1 | |
| kind: ConfigMap | |
| metadata: | |
| name: postgres-config | |
| labels: | |
| app: postgres | |
| data: | |
| POSTGRES_DB: postgres | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| --- | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: postgres | |
| labels: | |
| app: postgres | |
| spec: | |
| type: NodePort | |
| ports: | |
| - port: 5432 | |
| selector: | |
| app: postgres | |
| --- | |
| apiVersion: extensions/v1beta1 | |
| kind: Deployment | |
| metadata: | |
| name: postgres | |
| spec: | |
| template: | |
| metadata: | |
| labels: | |
| app: postgres | |
| spec: | |
| containers: | |
| - image: "postgres:9.5" | |
| name: postgres | |
| imagePullPolicy: "IfNotPresent" | |
| envFrom: | |
| - configMapRef: | |
| name: postgres-config | |
| ports: | |
| - containerPort: 5432 | |
| name: postgres | |
| volumeMounts: | |
| - name: postgres-storage | |
| mountPath: /var/lib/postgresql/data | |
| volumes: | |
| - name: postgres-storage | |
| persistentVolumeClaim: | |
| claimName: postgres-pvc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment