I am running into issues with Kubernetes Service Discovery on Spring Boot applications.
I should be able to discover the services whether my spring boot application is running within or out of Kubernetes cluster. Our local development won't be on k8s cluster.
I am using Service Discovery via DNS. I tried using spring-cloud-starter-kubernetes
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes</artifactId>
<version>0.2.0.RELEASE</version>
</dependency>
As per documentation you should be able to autowire DiscoveryClient and good to go
@Autowire
private DiscoveryClient discoveryClient;
DiscoveryClient is part of spring-cloud-commons. spring-cloud-starter-kuberenetes doesn't have it.
Anyone solved similar problem using the same library or a different one? Please share the solution
Thanks!
DiscoveryClientindeed is part ofspring-cloud-commons.spring-cloud-starter-kuberenetesprovide an implementation ofDiscoveryClient. - Sergii Bishyr