Kubernetes Discovery Client + Cloud Load Balancer WebClient Issue
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.