How to call Ratings service within FOO Service?

Hi all
I am using service mesh https://istio.io/ installed on top of kubernetes and have installed the example https://istio.io/docs/examples/bookinfo/, that ISTIO provides on their website.

Assume, I’ve created a service FOO and would like to call the service ratings through the virtual service ratings .

As you can see on the image, I’ve listed all virtual services installed on the kubernetes cluster and the cluster IP address is

The question is, how can I call the ratings service in FOO service? Through the Cluster IP address?

Thanks

You can call it the same as without istio, like curl ratings:9080 or similar. The application does not need to change

But how to call it with Istio? Why I would like to call with Istio is, consider the following scenario:

image

There are two version of RATINGS service V1 and V2. 40% of the traffic should go to V1 and rest to V2. For that, I going to create a Destion Rule. The question is, when I call the RATINGS service with curl ratings:9080, the Destion Rule will be applied or not?

Thanks

Assuming you have two version of the ratings service deployed, you would create a destination rule that looks like this:

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
    name: ratings
spec:
    host: ratings.default.svc.cluster.local
    subsets:
        - name: v1
          labels:
            version: v1
        - name: v2
          labels:
           version: v2

(Note that the above destination rule assumes you have two deployments of Ratings (e.g. ratings-v1 and ratings-v2) and the pods have the version:v1 or version:v2 labels set.

Once you have the destination rule deployed, you can update the VirtualService where you can split the traffic based on the subsets you defined in the destination rule. For example:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
    name: ratings
spec:
    hosts:
        - ratings.default.svc.cluster.local
    http:
        - route:
          - destination:
              host: ratings.default.svc.cluster.local
                port:
                    number: 9080
                subset: v1
            weight: 40
          - destination:
                host: ratings.default.svc.cluster.local
                port:
                    number: 9080
                subset: v2
            weight: 60