Search code examples
spring-bootkubernetesmicroservicesistio

Istio Service discovery


I'm trying out a very simple Istio setup on a Docker Desktop Kubernetes installation.

I have 2 Spring boot micro services and have deployed these 2 services in my K8s "cluster" without any replication. All I have in my YAML file is the Service and Deployment for both services.

I have installed istio and I can see there are 2 containers in my pod. One is the spring boot application, the other is the istio sidecar.

I am making a rest call from service 2 to service 1 like this and it works fine.

restTemplate.exchange("http://service1:8080/getSomeString", HttpMethod.GET, null, String.class, new Object()).getBody();

However, now if I disable sidecar injection and rededloy me services, it still works fine. Basically it is Kubernetes that is resolving where service1 is and completing the rest call and Not istio.

How do I do service discovery using istio ?


Solution

  • In Istio you can use virtual service for traffic management. Address multiple application services through a single virtual service. If your mesh uses Kubernetes, for example, you can configure a virtual service to handle all services in a specific namespace. Mapping a single virtual service to multiple “real” services is particularly useful in facilitating turning a monolithic application into a composite service built out of distinct microservices without requiring the consumers of the service to adapt to the transition. Your routing rules can specify “calls to these URIs of monolith.com go to microservice A”, and so on. You can see an example of how this works.