docs: update multi-cluster-services examples
This commit is contained in:
12
README.md
12
README.md
@@ -117,10 +117,14 @@ This allows workloads running in one cluster to access services running in anoth
|
||||
For example, if `cluster1` is running a Kubernetes Service that we need to access from Pods running in `cluster2`, we could do the following:
|
||||
|
||||
```shell
|
||||
# Register cluster1 as a peer of cluster2.
|
||||
kgctl --kubeconfig $KUBECONFIG1 showconf node $NODE1 --as-peer -o yaml --allowed-ips $PODCIDR1,$SERVICECIDR1 | kubectl --kubeconfig KUBECONFIG2 apply -f -
|
||||
# Register cluster2 as a peer of cluster1.
|
||||
kgctl --kubeconfig $KUBECONFIG2 showconf node $NODE2 --as-peer -o yaml --allowed-ips $PODCIDR2,$SERVICECIDR2 | kubectl --kubeconfig KUBECONFIG1 apply -f -
|
||||
# Register the nodes in cluster1 as peers of cluster2.
|
||||
for n in $(kubectl --kubeconfig $KUBECONFIG1 get no -o name | cut -d'/' -f2); do
|
||||
kgctl --kubeconfig $KUBECONFIG1 showconf node $n --as-peer -o yaml --allowed-ips $SERVICECIDR1 | kubectl --kubeconfig KUBECONFIG2 apply -f -
|
||||
done
|
||||
# Register the nodes in cluster2 as peers of cluster1.
|
||||
for n in $(kubectl --kubeconfig $KUBECONFIG2 get no -o name | cut -d'/' -f2); do
|
||||
kgctl --kubeconfig $KUBECONFIG2 showconf node $n --as-peer -o yaml --allowed-ips $SERVICECIDR2 | kubectl --kubeconfig KUBECONFIG1 apply -f -
|
||||
done
|
||||
# Create a Service in cluster2 to mirror the Service in cluster1.
|
||||
cat <<'EOF' | kubectl --kubeconfig $KUBECONFIG2 apply -f -
|
||||
apiVersion: v1
|
||||
|
||||
Reference in New Issue
Block a user