Search code examples
javadockerkubernetesmicroservices

Connection Timeout Problem in Inter service communication in microservices when deployed on kubernetes


I am working on a demo project , which has 5 microservices - discovery server , api-gateway , user-order-detail , order and user service.

I will expose the order and user service internally on GKE

I will expose the user-order-detail service externally which will call the other two services using a rest endpoint

Services that are up on google kubernetes engine:

user-order-detail LoadBalancer kubernetes ClusterIP order-management LoadBalancer user-management LoadBalancer

user-order-detail hits an endpoint to retrieve all users. I am getting this error :No matches for the virtual host name :user-management

Code :

String url = "user-management/user";
InstanceInfo instance = eurekaClient.getNextServerFromEureka("user-management", false);
Object response = restTemplate.getForObject(instance.getHomePageUrl() + url +"/" + userId, Object.class);

I am having problem in inter-service communication.please help

UPDATE: I was able to redirect my service,but I am getting connection timeout error.How should I solve this?

I/O error on GET request for "http://user-management/user-management/user/1": Operation timed out (Connection timed out); nested exception is java.net.ConnectException: Operation timed out (Connection timed out)


Solution

  • check the port for your service and target port port can be 80 targetport