I created an egress gateway for my AWS rds MySQL to access it via egress gateway. Without egress, my applications are able to connect the AWS rds MySQL while with egress unable to connect. Below is my resource manifests.
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: ch-aws-mysql
namespace: uat-cht-istio
spec:
hosts:
- AWS RDS MYSQL ENDPOINT DNS
ports: - name: tcp
number: 3306
protocol: tcp
location: MESH_EXTERNAL
resolution: DNS
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: istio-egressgateway-mysql
namespace: uat-cht-istio
spec:
selector:
istio: egressgateway
servers:
- port:
number: 3306
name: tcp-mysql
protocol: TCP
hosts:- “*”
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: ch-aws-mysql
namespace: uat-cht-istio
spec:
host: istio-egressgateway.istio-system.svc.cluster.local
subsets:
- name: ch-aws-mysql
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: app-cht-mysql-tcp-vs
namespace: uat-cht-istio
spec:
hosts:
- AWS RDS MYSQL ENDPOINT DNS
gateways: - mesh
- istio-egressgateway-mysql
exportTo: - .
tcp: - match:
- gateways:
- mesh
port: 3306
route:
- mesh
- destination:
host: istio-egressgateway.istio-system.svc.cluster.local
subset: ch-aws-mysql
port:
number: 3306
- gateways:
- match:
- gateways:
- istio-egressgateway-mysql
port: 3306
route:
- istio-egressgateway-mysql
- destination:
host: AWS RDS MYSQL ENDPOINT DNS
port:
number: 3306
- gateways: