I am new to Istio and I am trying to communicate 2 spring boot applications with Istio: component with requirement.
istioctl install --set profile=demo -y
kubectl label namespace default istio-injection=enabled
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: my-gateway
spec:
selector:
istio: ingressgateway # use istio default controller
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: my-gateway-vs
spec:
hosts:
- "*"
gateways:
- my-gateway
http:
- match:
- uri:
prefix: /component
route:
- destination:
host: component
port:
number: 8080
---
component app only has an enpoint: /component that returns a string, So far everything works fine.
The flow is as follows
my-gateway----->component
My question is how I can communicate component with requirement directly without going through istio-ingress-gateway.
my-gateway----->component ---->requirement
Is it possible?
Note: I have tried adding requirements in the virtual service but it seems to go through the istio-ingress-gateway and not directly from component to requirement.
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: my-gateway
spec:
selector:
istio: ingressgateway # use istio default controller
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: my-gateway-vs
spec:
hosts:
- "*"
gateways:
- my-gateway
http:
- match:
- uri:
prefix: /component
route:
- destination:
host: component
port:
number: 8080
- match:
- uri:
prefix: /requirement
route:
- destination:
host: requirement
port:
number: 8080
---
i am not sure why istio ingress controller coming inbetween for you.
You should checkout this nice simple example : https://istio.io/latest/docs/examples/bookinfo/#deploying-the-application
In istio example, you can see review service sending the request to rating service.
So for connection or service to service communication, you can use the just service name.
So if you check the review service source you will get an idea of how services calling other services.
Java example :
Python example :
https://github.com/istio/istio/blob/master/samples/bookinfo/src/productpage/productpage.py#L61
So for you end flow will be something like
istio-ingress-gateway----->service-1----->service-2