I am implementing a service that needs to talk to an external service without the need to specify the hostname in the application code. What I am trying to achieve is that I want to be able to just call the
/api/getUsers from one of my services inside the service mesh and it should match this endpoint with VirtualService and route traffic to external service defined in ServiceEntry. This way we don’t need to specify the full host name in any of our services in service mesh. It’s like making external service part of the mesh. I don’t know if it is supported by Istio yet or if there is a plan on adding this kind of feature. I went through the examples and they only work with port/protocol matching and not by URI.
VirtualService config is:
apiVersion: networking.istio.io/v1alpha3 kind: ServiceEntry metadata: name: external-api-sve spec: hosts: - external-service.elb.amazonaws.com location: MESH_EXTERNAL ports: - number: 80 name: http protocol: HTTP resolution: DNS --- apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: external-api-svc spec: hosts: - external-service.elb.amazonaws.com http: - match: - uri: exact: /api/getUsers route: - destination: host: external-service.elb.amazonaws.com
Thanks for your time!