1

I am new to Istio and I am trying to communicate 2 spring boot applications with Istio: component with requirement.

  1. I have installed Istio 1.13.2 on a GKE cluster with the demo profile:
istioctl install --set profile=demo -y
  1. I have automatically injected the sidecar proxy to the default namespace with:
kubectl label namespace default istio-injection=enabled
  1. I have defined istio ingress gateway as entry point and a virtual service that points to the component service.
 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
---

1 Answers1

0

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 :

https://github.com/istio/istio/blob/master/samples/bookinfo/src/reviews/reviews-application/src/main/java/application/rest/LibertyRestEndpoint.java#L42

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
Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
  • 1
    Thanks a lot !!!, I have reviewed the example again, I had not paid attention to the code of each application, I thought that Istio was in charge of the communication service-a ----> service-b, now I have seen that in the endpoints of each application the calls to each service are made. – Yuliani Moreno Mar 17 '22 at 17:23