spring-cloud / spring-cloud-config

External configuration (server and client) for Spring Cloud
Apache License 2.0
1.94k stars 1.28k forks source link

Spring Cloud Config client not able to connect to the Spring Cloud Config server #2404

Closed krisjha closed 2 months ago

krisjha commented 2 months ago

Describe the bug We are using spring-cloud-starter-config version 4.1.0 and spring-cloud-config-client version 4.1.0 .

Both our config server and config client microservice are running as pod in OpenShift environment. We don't have any issue when we are running one replica of config client, config client is successfully calling the config server rest api and getting the configuration parameter.

Problem starts when we are increasing the number of replica to 2 and starting both pod concurrently, in this case one of the pod gets the configuration from config server and other one fails and I find the below error message

main] o.s.c.c.c.ConfigServerConfigDataLoader : Fetching config from server at : http://config-svc:7002/api/v1/ss/config/getServiceConfig 2024-04-04T00:17:11.240Z INFO 1 --- [projectmgr-svc] [ main] o.s.c.c.c.ConfigServerConfigDataLoader : Exception on Url - http://config-svc:7002/api/v1/ss/config/getServiceConfig:org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://config-svc:7002/api/v1/ss/config/getServiceConfig/projectmgr-svc/DEV/1.0": config-svc. Will be trying the next url if available

We are using the service name of config server as both client and server are there in the same namespace.

Please let us know the corrective action which we should be taking to resolve this issue. Any help is much appreciated

ryanjbaxter commented 2 months ago

There is no reason why 2 instances can't connect to the config server. If they don't start concurrently do you not observe the issue? If you add Spring Retry to the client and the client retries the request does it work?

krisjha commented 2 months ago

Retry has solved the issue. But I fail to understand why at first go it is failing while the other is getting connected successfully.

There is no log statement generated at sever when client is not getting connected and at the client we are only getting the failed log which I posted in problem.

ryanjbaxter commented 2 months ago

I am wondering if this is some kind of issue with K8S, can you reproduce the issue outside of K8S?

spring-cloud-issues commented 2 months ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-cloud-issues commented 2 months ago

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.