Skip to content

Commit c111dd0

Browse files
authored
Merge pull request #101 from cr7258/fix-locality-loadbalance-doc
fix: locality loadbalance doc
2 parents 15bae3f + 97b2dab commit c111dd0

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

content/en/docs/userguide/locality_loadbalance.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ kubectl label node ambient-worker3 topology.kubernetes.io/subzone=subzone3
8686
```
8787

8888
2. start test servers
89+
- create `sample` namespace
90+
```
91+
kubectl create namespace sample
92+
```
8993
- run a service
9094
```
9195
kubectl apply -n sample -f - <<EOF
@@ -262,7 +266,7 @@ EOF
262266

263267
- Test the access.
264268
```
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"
266270
```
267271
The output is from the helloworld-region.zone1.subzone1 that is currently co-located on the ambient-worker.
268272
```
@@ -272,13 +276,11 @@ $ Hello version: region.zone1.subzone1, instance: helloworld-region.zone1.subzon
272276

273277
- Remove the service on the ambient-worker and test Failover.
274278
```
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
278280
```
279281

280282
```
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"
282284
```
283285

284286
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
288290

289291
- Relabel the locality of the ambient-worker3 same as the worker2 and test.
290292
```
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
294295
```
295296
delete helloworld-region.zone2.subzone3 and re-apply the development pod as follows, then run test:
296297
```
298+
kubectl delete deployment -n sample helloworld-region.zone2.subzone3
299+
297300
kubectl apply -n sample -f - <<EOF
298301
apiVersion: apps/v1
299302
kind: Deployment
@@ -333,7 +336,7 @@ EOF
333336

334337
test multi times:
335338
```
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"
337340
```
338341

339342
The output randomly shows helloworld-region.zone1.subzone2 and helloworld-region.zone1.subzone2-worker3.

0 commit comments

Comments
 (0)