Skip to content

Discovery Broken after upgrading to SpringBoot 4.0 and Spring Cloud Kubernetes 5.0 #2103

@SanMorei-opos

Description

@SanMorei-opos

Describe the bug
I was using Spring V3.5.7 and SpringCloud Kubernetes 3.3.0 without any issues, my app can automatically detect my other services by name in k8s.

After upgrading to 4.0.0 and 5.0.0, it just broke.
The dependencies I use are:

  • spring-cloud-starter-kubernetes-client
  • spring-cloud-starter-kubernetes-client-loadbalancer

The messages when trying to load the app are:

INFO","logger":"org.springframework.cloud.kubernetes.client.discovery.KubernetesClientDiscoveryClientUtils","thread":"pool-7-thread-1","message":"Waiting for the cache of informers to be fully loaded

INFO","logger":"org.springframework.cloud.kubernetes.client.discovery.KubernetesClientDiscoveryClientUtils","thread":"main","message":"Cache fully loaded (total 0 services), discovery client is now available

And then, the loadBalancer when trying to connect to my service throws:

WARN","logger":"org.springframework.cloud.loadbalancer.core.RoundRobinLoadBalancer","thread":"loomBoundedElastic-1","message":"No servers available for service: db-api"

I did not change anything (permissions, helm, etc) except the corresponding spring dependencies for the app to be working again.

The service is in fact available as seen here:

sh: kubectl get services
NAME                    TYPE      
db-api                  ClusterIP 

And from inside the POD I can do a curl to db-api without any issues at all.

Things I tried that I didn´t have to do before upgrading:

  • Disabling/Enabling cache options
  • Using Endpoint Slices
  • Forcing to not filter by any label
  • Double checked that everything else was as before (metadata names, labels, etc)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions