fix the egress gateway example for multi cluster gateways (#4397)

* fix the egress gateway example

need to change static because one address was host the other was ip.

* update to make it cleaner

* minor typo

* minor tweaks

* fix lint

* format change

* fix lint

* fix lint

* clean up tips per frank and shriram's suggestion

* fix lint
This commit is contained in:
Lin Sun 2019-06-14 17:34:40 -04:00 committed by GitHub
parent 64dd2961b7
commit 118fc23b92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 53 additions and 2 deletions

View File

@ -139,14 +139,61 @@ running in a second cluster.
## Send remote cluster traffic using egress gateway
If you want to route traffic from `cluster1` via a dedicated
egress gateway, instead of directly from the sidecars,
If you want to route traffic from `cluster1` via a dedicated egress gateway, instead of directly from the sidecars,
use the following service entry for `httpbin.bar` instead of the one in the previous section.
{{< tip >}}
The egress gateway used in this configuration cannot also be used for other, non inter-cluster, egress traffic.
{{< /tip >}}
If `$CLUSTER2_GW_ADDR` is an IP address, use the `$CLUSTER2_GW_ADDR - IP address` option. If `$CLUSTER2_GW_ADDR` is a hostname, use the `$CLUSTER2_GW_ADDR - hostname` option.
{{< tabset cookie-name="profile" >}}
{{< tab name="$CLUSTER2_GW_ADDR - IP address" cookie-value="option1" >}}
* Export the `cluster1` egress gateway address:
{{< text bash >}}
$ export CLUSTER1_EGW_ADDR=$(kubectl get --context=$CTX_CLUSTER1 svc --selector=app=istio-egressgateway \
-n istio-system -o yaml -o jsonpath='{.items[0].spec.clusterIP}')
{{< /text >}}
* Apply the httpbin-bar service entry:
{{< text bash >}}
$ kubectl apply --context=$CTX_CLUSTER1 -n foo -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: httpbin-bar
spec:
hosts:
# must be of form name.namespace.global
- httpbin.bar.global
location: MESH_INTERNAL
ports:
- name: http1
number: 8000
protocol: http
resolution: STATIC
addresses:
- 127.255.0.2
endpoints:
- address: ${CLUSTER2_GW_ADDR}
network: external
ports:
http1: 15443 # Do not change this port value
- address: ${CLUSTER1_EGW_ADDR}
ports:
http1: 15443
EOF
{{< /text >}}
{{< /tab >}}
{{< tab name="$CLUSTER2_GW_ADDR - hostname" cookie-value="option2" >}}
If the `${CLUSTER2_GW_ADDR}` is a hostname, you can use `resolution: DNS` for the endpoint resolution:
{{< text bash >}}
$ kubectl apply --context=$CTX_CLUSTER1 -n foo -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
@ -176,6 +223,10 @@ spec:
EOF
{{< /text >}}
{{< /tab >}}
{{< /tabset >}}
## Version-aware routing to remote services
If the remote service has multiple versions, you can add