Spring rest template strange behavior in kubernetes

10/29/2018

I have two Spring boot services in Kubernetes (Google Cloud).

Service1 executes http request using org.springframework.web.client.RestTemplate to Service2 using Service name. In Both cases Service1 receives the following error: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://service1/tcp:/10.11.252.122:8080": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)

when 10.11.252.122 is Service2 cluster IP.

It happens only when Service1 and Service2 are in the same cluster, in other cases code works properly.

What can cause Spring to add tcp:/Cluser IP to url?

Thanks,

-- Zavolokin Roman
kubernetes
resttemplate
spring

0 Answers