forked from ml-lab/DeepVideoAnalytics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostgres.yaml
78 lines (78 loc) · 1.62 KB
/
postgres.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
apiVersion: v1
kind: Service
metadata:
name: postgres-master
labels:
app: postgres
tier: backend
role: master
spec:
selector:
app: postgres
tier: backend
role: master
ports:
- port: 5432
targetPort: 5432
clusterIP: None
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: postgresdata-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: standard
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: postgres-master
spec:
replicas: 1
serviceName: "postgres-master"
template:
metadata:
labels:
app: postgres
role: master
tier: backend
spec:
containers:
- image: postgres:9.6-alpine
resources:
requests:
memory: "2000Mi"
cpu: "2"
limits:
memory: "4000Mi"
cpu: "4"
imagePullPolicy: "IfNotPresent"
name: master
env:
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-secret
key: dbusername
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secret
key: dbpassword
ports:
- containerPort: 5432
name: postgres-master
volumeMounts:
- name: postgres-data
mountPath: "/var/lib/postgresql/data"
volumes:
- name: postgres-data
persistentVolumeClaim:
claimName: postgresdata-claim