From 97b2dab89f7d8e47ae76e837f12d2b1ab548139c Mon Sep 17 00:00:00 2001 From: Se7en Date: Sun, 29 Dec 2024 23:00:36 +0800 Subject: [PATCH] fix: locality loadbalance doc Signed-off-by: Se7en --- .../en/docs/userguide/locality_loadbalance.md | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/content/en/docs/userguide/locality_loadbalance.md b/content/en/docs/userguide/locality_loadbalance.md index 7153c9d..ef8cebb 100644 --- a/content/en/docs/userguide/locality_loadbalance.md +++ b/content/en/docs/userguide/locality_loadbalance.md @@ -86,6 +86,10 @@ kubectl label node ambient-worker3 topology.kubernetes.io/subzone=subzone3 ``` 2. start test servers +- create `sample` namespace +``` +kubectl create namespace sample +``` - run a service ``` kubectl apply -n sample -f - < # name of the pod on the ambient-worker +kubectl delete deployment -n sample helloworld-region.zone1.subzone1 ``` ``` -kubectl exec "$(kubectl get pod -l app=sleep -o jsonpath='{.items[0].metadata.name}')" -c sleep -- curl -sSL "http://helloworld:5000/hello" +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" ``` 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 - Relabel the locality of the ambient-worker3 same as the worker2 and test. ``` -kubectl label node ambient-worker3 topology.kubernetes.io/region=region -kubectl label node ambient-worker3 topology.kubernetes.io/zone=zone1 -kubectl label node ambient-worker3 topology.kubernetes.io/subzone=subzone2 +kubectl label node ambient-worker3 topology.kubernetes.io/zone=zone1 --overwrite +kubectl label node ambient-worker3 topology.kubernetes.io/subzone=subzone2 --overwrite ``` delete helloworld-region.zone2.subzone3 and re-apply the development pod as follows, then run test: ``` +kubectl delete deployment -n sample helloworld-region.zone2.subzone3 + kubectl apply -n sample -f - <