Before you begin

    For simplicity, we will assume that there is only a single primary cluster in the mesh. This simplifies the process of configuring the control plane, since changes only need to be applied to one cluster.

    We will deploy several instances of the HelloWorld application as follows:

    Setup for locality load balancing tasks

    This guide assumes that all clusters will be accessed through contexts in the default . The following environment variables will be used for the various contexts:

    Create the sample namespace

    To begin, generate yaml for the sample namespace with automatic sidecar injection enabled:

    Add the sample namespace to each cluster:

    1. $ for CTX in "$CTX_PRIMARY" "$CTX_R1_Z1" "$CTX_R1_Z2" "$CTX_R2_Z3" "$CTX_R3_Z4"; \
    2. kubectl --context="$CTX" apply -f sample.yaml; \
    3. done

    Generate the HelloWorld YAML for each locality, using the locality as the version string:

    1. $ for LOC in "region1.zone1" "region1.zone2" "region2.zone3" "region3.zone4"; \
    2. ./@samples/helloworld/gen-helloworld.sh@ \
    3. --version "$LOC" > "helloworld-${LOC}.yaml"; \
    4. done
    1. $ kubectl apply --context="${CTX_R1_Z1}" -n sample \
    2. -f helloworld-region1.zone1.yaml
    1. $ kubectl apply --context="${CTX_R2_Z3}" -n sample \
    2. -f helloworld-region2.zone3.yaml
    1. $ kubectl apply --context="${CTX_R3_Z4}" -n sample \
    2. -f helloworld-region3.zone4.yaml

    Deploy Sleep

    Deploy the application to region1 zone1:

    1. $ kubectl apply --context="${CTX_R1_Z1}" \
    2. -f @samples/sleep/sleep.yaml@ -n sample

    Wait until the HelloWorld pods in each zone are Running:

    1. $ kubectl get pod --context="${CTX_R1_Z2}" -n sample -l app="helloworld" \
    2. NAME READY STATUS RESTARTS AGE
    3. helloworld-region1.zone2-86f77cd7b-cpxhv 2/2 Running 0 30s
    1. $ kubectl get pod --context="${CTX_R2_Z3}" -n sample -l app="helloworld" \
    2. -l version="region2.zone3"
    3. NAME READY STATUS RESTARTS AGE
    4. helloworld-region2.zone3-86f77cd7b-cpxhv 2/2 Running 0 30s
    1. $ kubectl get pod --context="${CTX_R3_Z4}" -n sample -l app="helloworld" \
    2. -l version="region3.zone4"
    3. helloworld-region3.zone4-86f77cd7b-cpxhv 2/2 Running 0 30s

    Congratulations! You successfully configured the system and are now ready to begin the locality load balancing tasks!

    Next steps

    You can now configure one of the following load balancing options:

    Only one of the load balancing options should be configured, as they are mutually exclusive. Attempting to configure both may lead to unexpected behavior.

    Locality weighted distribution

    This guide demonstrates how to configure locality distribution.

    Initial steps before installing Istio on multiple clusters.

    Cleanup

    Cleanup steps for locality load balancing.

    Install an Istio mesh across multiple primary clusters.

    Install Multi-Primary on different networks