Skip to content

Commit 2302868

Browse files
committed
[k8s] add material for lab 5
1 parent 91c8b2d commit 2302868

File tree

1 file changed

+317
-0
lines changed

1 file changed

+317
-0
lines changed

esigelec/lab/microservice5.yaml

Lines changed: 317 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,317 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: config-server
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: config-server
10+
template:
11+
metadata:
12+
labels:
13+
app: config-server
14+
spec:
15+
containers:
16+
- name: config-server
17+
image: springcommunity/spring-petclinic-config-server
18+
env:
19+
- name: SPRING_CLOUD_DISCOVERY_ENABLED
20+
value: "false"
21+
ports:
22+
- containerPort: 8888
23+
resources:
24+
requests:
25+
cpu: 250m
26+
memory: 256Mi
27+
limits:
28+
cpu: 500m
29+
memory: 512Mi
30+
---
31+
apiVersion: v1
32+
kind: Service
33+
metadata:
34+
name: config-server
35+
spec:
36+
type: ClusterIP
37+
selector:
38+
app: config-server
39+
ports:
40+
- protocol: TCP
41+
port: 8888
42+
targetPort: 8888
43+
---
44+
apiVersion: v1
45+
kind: ConfigMap
46+
metadata:
47+
name: api-gateway-config
48+
data:
49+
application.yml: |
50+
spring:
51+
application:
52+
name: api-gateway
53+
config:
54+
import: optional:configserver:http://config-server:8888
55+
cloud:
56+
gateway:
57+
default-filters:
58+
- name: CircuitBreaker
59+
args:
60+
name: defaultCircuitBreaker
61+
fallbackUri: forward:/fallback
62+
- name: Retry
63+
args:
64+
retries: 1
65+
statuses: SERVICE_UNAVAILABLE
66+
methods: POST
67+
routes:
68+
- id: vets-service
69+
uri: http://vets-service
70+
predicates:
71+
- Path=/api/vet/**
72+
filters:
73+
- StripPrefix=2
74+
- id: visits-service
75+
uri: http://visits-service
76+
predicates:
77+
- Path=/api/visit/**
78+
filters:
79+
- StripPrefix=2
80+
- id: customers-service
81+
uri: http://customers-service
82+
predicates:
83+
- Path=/api/customer/**
84+
filters:
85+
- StripPrefix=2
86+
- id: genai-service
87+
uri: http://genai-service
88+
predicates:
89+
- Path=/api/genai/**
90+
filters:
91+
- StripPrefix=2
92+
- CircuitBreaker=name=genaiCircuitBreaker,fallbackUri=/fallback
93+
---
94+
apiVersion: apps/v1
95+
kind: Deployment
96+
metadata:
97+
name: api-gateway
98+
spec:
99+
selector:
100+
matchLabels:
101+
app: api-gateway
102+
template:
103+
metadata:
104+
labels:
105+
app: api-gateway
106+
spec:
107+
containers:
108+
- name: main
109+
# note: don't use the official image because it has some issues in the frontend
110+
# image: springcommunity/spring-petclinic-api-gateway
111+
image: mincongclassroom/spring-petclinic-api-gateway:bcf6d05
112+
env:
113+
- name: SPRING_CONFIG_LOCATION
114+
value: file:/workspace/config/application.yml
115+
- name: SPRING_CLOUD_DISCOVERY_ENABLED
116+
value: "false"
117+
- name: LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_CLOUD_GATEWAY
118+
value: "DEBUG"
119+
- name: LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_WEB
120+
value: "DEBUG"
121+
- name: LOGGING_LEVEL_REACTOR_NETTY
122+
value: "DEBUG"
123+
resources:
124+
requests:
125+
cpu: 250m
126+
memory: 256Mi
127+
limits:
128+
cpu: 500m
129+
memory: 512Mi
130+
volumeMounts:
131+
- name: config-volume
132+
mountPath: /workspace/config # specific path for Spring application
133+
ports:
134+
- containerPort: 8080
135+
volumes:
136+
- name: config-volume
137+
configMap:
138+
name: api-gateway-config
139+
---
140+
apiVersion: v1
141+
kind: Service
142+
metadata:
143+
name: api-gateway
144+
spec:
145+
type: ClusterIP
146+
selector:
147+
app: api-gateway
148+
ports:
149+
- protocol: TCP
150+
port: 80
151+
targetPort: 8080
152+
---
153+
apiVersion: apps/v1
154+
kind: Deployment
155+
metadata:
156+
name: customers-service
157+
spec:
158+
replicas: 1
159+
selector:
160+
matchLabels:
161+
app: customers-service
162+
template:
163+
metadata:
164+
labels:
165+
app: customers-service
166+
spec:
167+
containers:
168+
- name: main
169+
image: springcommunity/spring-petclinic-customers-service
170+
env:
171+
- name: SPRING_CLOUD_DISCOVERY_ENABLED
172+
value: "false"
173+
ports:
174+
- containerPort: 8081
175+
resources:
176+
requests:
177+
cpu: 250m
178+
memory: 256Mi
179+
limits:
180+
cpu: 500m
181+
memory: 512Mi
182+
---
183+
apiVersion: v1
184+
kind: Service
185+
metadata:
186+
name: customers-service
187+
spec:
188+
type: ClusterIP
189+
selector:
190+
app: customers-service
191+
ports:
192+
- protocol: TCP
193+
port: 80
194+
targetPort: 8081
195+
---
196+
apiVersion: apps/v1
197+
kind: Deployment
198+
metadata:
199+
name: visits-service
200+
spec:
201+
selector:
202+
matchLabels:
203+
app: visits-service
204+
template:
205+
metadata:
206+
labels:
207+
app: visits-service
208+
spec:
209+
containers:
210+
- name: main
211+
image: springcommunity/spring-petclinic-visits-service
212+
env:
213+
- name: SPRING_CLOUD_DISCOVERY_ENABLED
214+
value: "false"
215+
resources:
216+
requests:
217+
cpu: 250m
218+
memory: 256Mi
219+
limits:
220+
cpu: 500m
221+
memory: 512Mi
222+
ports:
223+
- containerPort: 8082
224+
---
225+
apiVersion: v1
226+
kind: Service
227+
metadata:
228+
name: visits-service
229+
spec:
230+
type: ClusterIP
231+
selector:
232+
app: visits-service
233+
ports:
234+
- protocol: TCP
235+
port: 80
236+
targetPort: 8082
237+
---
238+
apiVersion: apps/v1
239+
kind: Deployment
240+
metadata:
241+
name: vets-service
242+
spec:
243+
selector:
244+
matchLabels:
245+
app: vets-service
246+
template:
247+
metadata:
248+
labels:
249+
app: vets-service
250+
spec:
251+
containers:
252+
- name: main
253+
image: springcommunity/spring-petclinic-vets-service
254+
env:
255+
- name: SPRING_CLOUD_DISCOVERY_ENABLED
256+
value: "false"
257+
resources:
258+
requests:
259+
cpu: 250m
260+
memory: 256Mi
261+
limits:
262+
cpu: 500m
263+
memory: 512Mi
264+
ports:
265+
- containerPort: 8083
266+
---
267+
apiVersion: v1
268+
kind: Service
269+
metadata:
270+
name: vets-service
271+
spec:
272+
type: ClusterIP
273+
selector:
274+
app: vets-service
275+
ports:
276+
- protocol: TCP
277+
port: 80
278+
targetPort: 8083
279+
---
280+
apiVersion: apps/v1
281+
kind: Deployment
282+
metadata:
283+
name: tracing-server
284+
spec:
285+
selector:
286+
matchLabels:
287+
app: tracing-server
288+
template:
289+
metadata:
290+
labels:
291+
app: tracing-server
292+
spec:
293+
containers:
294+
- name: main
295+
image: openzipkin/zipkin
296+
resources:
297+
requests:
298+
cpu: 250m
299+
memory: 256Mi
300+
limits:
301+
cpu: 500m
302+
memory: 512Mi
303+
ports:
304+
- containerPort: 9411
305+
---
306+
apiVersion: v1
307+
kind: Service
308+
metadata:
309+
name: tracing-server
310+
spec:
311+
type: ClusterIP
312+
selector:
313+
app: tracing-server
314+
ports:
315+
- protocol: TCP
316+
port: 9411
317+
targetPort: 9411

0 commit comments

Comments
 (0)