-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostgres.yaml
125 lines (125 loc) · 3.03 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: qa
labels:
service: postgres
env: qa
spec:
clusterIP: None
ports:
- name: postgres
port: 5432
targetPort: postgres
publishNotReadyAddresses: true
selector:
service: postgres
env: qa
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: postgres-ui
namespace: qa
annotations:
cloud.google.com/load-balancer-type: "Internal"
labels:
service: postgres
env: qa
spec:
externalTrafficPolicy: Cluster
ports:
- name: postgres
nodePort: 30222
port: 5432
targetPort: postgres
selector:
service: postgres
env: qa
type: LoadBalancer
loadBalancerIP: "10.151.0.17"
loadBalancerSourceRanges:
- 10.0.0.0/8
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres
namespace: qa
labels:
service: postgres
spec:
serviceName: postgres
replicas: 1
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
service: postgres
env: qa
template:
metadata:
labels:
service: postgres
env: qa
spec:
terminationGracePeriodSeconds: 500
containers:
- name: postgres
image: postgres:10.8
imagePullPolicy: Always
securityContext:
privileged: false
ports:
- name: postgres
containerPort: 5432
env:
- name: POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secret
key: POSTGRES_PASSWORD
livenessProbe:
failureThreshold: 10
initialDelaySeconds: 1000
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 10
exec:
command:
- sh
- -c
- exec pg_isready --host $POD_IP
readinessProbe:
failureThreshold: 10
initialDelaySeconds: 500
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 10
exec:
command:
- sh
- -c
- exec pg_isready --host $POD_IP
resources:
requests:
memory: "15G"
cpu: "4"
limits:
memory: "30G"
cpu: "8"
volumeMounts:
- name: postgresql-data
mountPath: /var/lib/postgresql/data
volumes:
- name: postgresql-data
hostpath:
path: /tmp
type: Directory