spring-cloud / spring-cloud/spring-cloud-commons
Kubernetes Discovery Client + Cloud Load Balancer WebClient Issue
@OlgaMaciaszek is already working on this.
Since Jun 10, 2022.
- Dominant language
- Java
- Stars
- 751
- Forks
- 744
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
Description
A Spring Boot project with spring-cloud-starter-kubernetes-discoveryclient and spring-cloud-starter-loadbalancer enabled is unable to communicate with a spring-cloud-kubernetes-discoveryserver.
If spring-cloud-starter-loadbalancer is removed from the classpath, the KubernetesReactiveDiscoveryClient is able to successfully communicate with the discovery server.
It seems that spring-cloud-starter-loadbalancer modifies the WebClient.Builder by adding a Load Balancer exchange filter and it is now unable to communicate with the discovery server with a Media Type Exception.
2022-04-13 20:40:03.165 ERROR 1 --- [ parallel-1] scoveryClientServiceInstanceListSupplier : Exception occurred while retrieving instances for service spring-cloud-kubernetes-discoveryserver
org.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'application/octet-stream' not supported for bodyType=org.springframework.cloud.kubernetes.discovery.KubernetesServiceInstance
at org.springframework.web.reactive.function.BodyExtractors.lambda$readWithMessageReaders$12(BodyExtractors.java:201) ~[spring-webflux-5.3.18.jar:5.3.18]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
*__checkpoint ? Body from UNKNOWN [DefaultClientResponse]
I couldn't find a straightforward way to modify the WebClient so it would be able to successfully communicate with the discovery server, are there any insights here?
Thank you
Sample
This repository includes an application and a Kubernetes deployment script along with a README with more details about building and reproducing this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.