-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkubernetes-deployment.yaml
240 lines (228 loc) · 4.17 KB
/
kubernetes-deployment.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
apiVersion: v1
kind: ConfigMap
metadata:
name: wupfh-config
data:
KAFKA_BROKERS: "kkafka:9092"
USER_SERVICE_URL: "user:8081"
NOTIFICATION_SERVICE_URL: "notification:8082"
AUTH_SERVICE_ADDR: "user:50051"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: user
spec:
replicas: 1
selector:
matchLabels:
app: user
template:
metadata:
labels:
app: user
spec:
containers:
- name: user
image: wuphf-dot-com-user-service:local
imagePullPolicy: Never
envFrom:
- configMapRef:
name: wupfh-config
ports:
- containerPort: 8081
---
apiVersion: v1
kind: Service
metadata:
name: user
spec:
type: NodePort
ports:
- name: http
port: 8081
targetPort: 8081
selector:
app: user
---
apiVersion: v1
kind: Service
metadata:
name: zookeeper
spec:
ports:
- port: 2181
targetPort: 2181
selector:
app: zookeeper
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: zookeeper
spec:
serviceName: zookeeper
replicas: 1
selector:
matchLabels:
app: zookeeper
template:
metadata:
labels:
app: zookeeper
spec:
containers:
- name: zookeeper
image: confluentinc/cp-zookeeper:latest
env:
- name: ZOOKEEPER_CLIENT_PORT
value: "2181"
ports:
- containerPort: 2181
---
apiVersion: v1
kind: Service
metadata:
name: kkafka
spec:
type: ClusterIP
ports:
- port: 9092
targetPort: 9092
selector:
app: kkafka
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: kkafka
spec:
serviceName: kkafka
replicas: 1
selector:
matchLabels:
app: kkafka
template:
metadata:
labels:
app: kkafka
spec:
containers:
- name: kkafka
image: confluentinc/cp-kafka:latest
env:
- name: "KAFKA_BROKER_ID"
value: "1"
- name: KAFKA_ZOOKEEPER_CONNECT
value: "zookeeper:2181"
- name: KAFKA_ADVERTISED_LISTENERS
value: "PLAINTEXT://localhost:29092,PLAINTEXT_HOST://kkafka:9092"
- name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
value: "PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT"
- name: KAFKA_INTER_BROKER_LISTENER_NAME
value: "PLAINTEXT"
- name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
value: "1"
ports:
- containerPort: 9092
---
apiVersion: v1
kind: Secret
metadata:
name: test-secret
data:
TWILIO_ACCOUNT_SID: ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TWILIO_AUTH_TOKEN: your_auth_token
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: notification
spec:
replicas: 1
selector:
matchLabels:
app: notification
template:
metadata:
labels:
app: notification
spec:
containers:
- name: notification
image: wuphf-dot-com-notification-service:local
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: wupfh-config
ports:
- containerPort: 8082
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: notification-autoscaler
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: notification
minReplicas: 1
maxReplicas: 3
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80
---
apiVersion: v1
kind: Service
metadata:
name: notification
spec:
type: NodePort
ports:
- name: http
port: 8082
targetPort: 8082
selector:
app: notification
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-gateway
spec:
replicas: 1
selector:
matchLabels:
app: api-gateway
template:
metadata:
labels:
app: api-gateway
spec:
containers:
- name: api-gateway
image: wuphf-dot-com-api-gateway:local
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: wupfh-config
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: api-gateway
spec:
type: NodePort
ports:
- name: http
port: 80
targetPort: 8080
selector:
app: api-gateway