istio.io/istio@v0.0.0-20240520182934-d79c90f27776/tests/testdata/config/se-example-gw.yaml (about) 1 #The following example demonstrates the use of a dedicated egress gateway 2 #through which all external service traffic is forwarded. 3 4 5 # Sidecar - no imports defined, isolated namespace. 6 apiVersion: networking.istio.io/v1alpha3 7 kind: Sidecar 8 metadata: 9 name: default 10 namespace: exampleegressgw 11 spec: 12 egress: 13 - hosts: 14 - exampleegressgw/* 15 --- 16 # Test workload entry 17 apiVersion: networking.istio.io/v1alpha3 18 kind: ServiceEntry 19 metadata: 20 name: workload 21 namespace: exampleegressgw 22 spec: 23 hosts: 24 - test.exampleegressgw 25 26 ports: 27 - number: 1300 28 name: tcplocal 29 protocol: TCP 30 31 location: MESH_INTERNAL 32 resolution: STATIC 33 34 endpoints: 35 - address: 10.13.0.1 36 ports: 37 tcplocal: 31200 38 --- 39 40 apiVersion: networking.istio.io/v1alpha3 41 kind: ServiceEntry 42 metadata: 43 name: external-svc-httpbin 44 namespace: exampleegressgw 45 spec: 46 hosts: 47 - httpbin.org 48 location: MESH_EXTERNAL 49 ports: 50 - number: 80 51 name: http 52 protocol: HTTP 53 resolution: DNS 54 55 --- 56 apiVersion: networking.istio.io/v1alpha3 57 kind: Gateway 58 metadata: 59 name: istio-egressgateway 60 namespace: exampleegressgw 61 spec: 62 selector: 63 istio: egressgateway 64 servers: 65 - port: 66 number: 80 67 name: http 68 protocol: HTTP 69 hosts: 70 - "*" 71 --- 72 #And the associated VirtualService to route from the sidecar to the 73 #gateway service (istio-egressgateway.istio-system.svc.cluster.local), as 74 #well as route from the gateway to the external service. 75 apiVersion: networking.istio.io/v1alpha3 76 kind: VirtualService 77 metadata: 78 name: gateway-routing 79 namespace: exampleegressgw 80 spec: 81 hosts: 82 - httpbin.com 83 gateways: 84 - mesh 85 - istio-egressgateway 86 http: 87 - match: 88 - port: 80 89 gateways: 90 - mesh 91 route: 92 - destination: 93 host: istio-egressgateway.istio-system.svc.cluster.local 94 - match: 95 - port: 80 96 gateways: 97 - istio-egressgateway 98 route: 99 - destination: 100 host: httpbin.com 101 ---