@@ -86,6 +86,10 @@ kubectl label node ambient-worker3 topology.kubernetes.io/subzone=subzone3
86
86
```
87
87
88
88
2 . start test servers
89
+ - create ` sample ` namespace
90
+ ```
91
+ kubectl create namespace sample
92
+ ```
89
93
- run a service
90
94
```
91
95
kubectl apply -n sample -f - <<EOF
262
266
263
267
- Test the access.
264
268
```
265
- $ kubectl exec "$(kubectl get pod -l app=sleep -o jsonpath='{.items[0].metadata.name}')" -c sleep -- curl -sSL "http://helloworld:5000/hello"
269
+ kubectl exec -n sample "$(kubectl get pod -n sample -l app=sleep -o jsonpath='{.items[0].metadata.name}')" -c sleep -- curl -sSL "http://helloworld:5000/hello"
266
270
```
267
271
The output is from the helloworld-region.zone1.subzone1 that is currently co-located on the ambient-worker.
268
272
```
@@ -272,13 +276,11 @@ $ Hello version: region.zone1.subzone1, instance: helloworld-region.zone1.subzon
272
276
273
277
- Remove the service on the ambient-worker and test Failover.
274
278
```
275
- kubectl get deployment
276
- # list of name
277
- kubectl delete deployment <name> # name of the pod on the ambient-worker
279
+ kubectl delete deployment -n sample helloworld-region.zone1.subzone1
278
280
```
279
281
280
282
```
281
- kubectl exec "$(kubectl get pod -l app=sleep -o jsonpath='{.items[0].metadata.name}')" -c sleep -- curl -sSL "http://helloworld:5000/hello"
283
+ kubectl exec -n sample "$(kubectl get pod -n sample -l app=sleep -o jsonpath='{.items[0].metadata.name}')" -c sleep -- curl -sSL "http://helloworld:5000/hello"
282
284
```
283
285
284
286
The output is helloworld-region.zone1.subzone2, and a failover of the traffic has occurred.
@@ -288,12 +290,13 @@ $ Hello version: region.zone1.subzone2, instance: helloworld-region.zone1.subzon
288
290
289
291
- Relabel the locality of the ambient-worker3 same as the worker2 and test.
290
292
```
291
- kubectl label node ambient-worker3 topology.kubernetes.io/region=region
292
- kubectl label node ambient-worker3 topology.kubernetes.io/zone=zone1
293
- kubectl label node ambient-worker3 topology.kubernetes.io/subzone=subzone2
293
+ kubectl label node ambient-worker3 topology.kubernetes.io/zone=zone1 --overwrite
294
+ kubectl label node ambient-worker3 topology.kubernetes.io/subzone=subzone2 --overwrite
294
295
```
295
296
delete helloworld-region.zone2.subzone3 and re-apply the development pod as follows, then run test:
296
297
```
298
+ kubectl delete deployment -n sample helloworld-region.zone2.subzone3
299
+
297
300
kubectl apply -n sample -f - <<EOF
298
301
apiVersion: apps/v1
299
302
kind: Deployment
333
336
334
337
test multi times:
335
338
```
336
- kubectl exec "$(kubectl get pod -l app=sleep -o jsonpath='{.items[0].metadata.name}')" -c sleep -- curl -sSL "http://helloworld:5000/hello"
339
+ kubectl exec -n sample "$(kubectl get pod -n sample -l app=sleep -o jsonpath='{.items[0].metadata.name}')" -c sleep -- curl -sSL "http://helloworld:5000/hello"
337
340
```
338
341
339
342
The output randomly shows helloworld-region.zone1.subzone2 and helloworld-region.zone1.subzone2-worker3.
0 commit comments