...
1# Two backend pods, one always failing
2# and another one returning OK response
3# Slowcooker is used to generate traffic
4# that will be routed via traffic split
5---
6apiVersion: apps/v1
7kind: Deployment
8metadata:
9 name: backend
10spec:
11 replicas: 1
12 selector:
13 matchLabels:
14 app: backend
15 template:
16 metadata:
17 labels:
18 app: backend
19 spec:
20 containers:
21 - name: backend
22 image: buoyantio/bb:v0.0.6
23 args:
24 - terminus
25 - "--h1-server-port=8080"
26 - "--response-text=backend1"
27 ports:
28 - containerPort: 8080
29---
30apiVersion: v1
31kind: Service
32metadata:
33 name: backend-svc
34spec:
35 selector:
36 app: backend
37 ports:
38 - name: http
39 port: 8080
40 targetPort: 8080
41---
42apiVersion: apps/v1
43kind: Deployment
44metadata:
45 name: failing
46spec:
47 replicas: 1
48 selector:
49 matchLabels:
50 app: failing
51 template:
52 metadata:
53 labels:
54 app: failing
55 spec:
56 containers:
57 - name: failing
58 image: buoyantio/bb:v0.0.6
59 args:
60 - terminus
61 - "--h1-server-port=8080"
62 - "--response-text=failing"
63 - "--percent-failure=100"
64 ports:
65 - containerPort: 8080
66---
67apiVersion: v1
68kind: Service
69metadata:
70 name: failing-svc
71spec:
72 selector:
73 app: failing
74 ports:
75 - name: http
76 port: 8080
77 targetPort: 8080
78---
79apiVersion: apps/v1
80kind: Deployment
81metadata:
82 name: slow-cooker
83spec:
84 replicas: 1
85 selector:
86 matchLabels:
87 app: slow-cooker
88 template:
89 metadata:
90 labels:
91 app: slow-cooker
92 spec:
93 containers:
94 - name: slow-cooker
95 image: buoyantio/slow_cooker:1.3.0
96 command:
97 - "/bin/sh"
98 args:
99 - "-c"
100 - |
101 sleep 5 # wait for pods to start
102 /slow_cooker/slow_cooker http://backend-svc:8080
103 ports:
104 - containerPort: 9999
105---
106apiVersion: v1
107kind: Service
108metadata:
109 name: slow-cooker
110spec:
111 selector:
112 app: slow-cooker
113 ports:
114 - name: metrics
115 port: 9999
116 targetPort: 9999
View as plain text