How to get GRPC's round_robin load balancing to work using grpc-java in Kubernetes cluster?
I found some issue of your code:
- In client, you should use
forTarget
rather thanforAddress
likedns:///grpc-receiver:6565
, because kubernetes service route by dns, have a try for this name resolver, and make sure your server has multiple instances. - The exception
NoSuchFieldError: NAME_RESOLVER_SERVICE_CONFIG
is caused by lib not match, the grpc-services version is1.25.0
, but grpc-core version is1.34.1
, so make them in same version, and it should be worked correcttly.