Skip to content

grpc service behind k8-headless service is not loadbalancing. #5621

@vkc12uec

Description

@vkc12uec

Hi, I have this setup/request flow:

service1 -----> k8-headless-service -------> grpcservice2

(followed this blog)
That is service1 wants to talk to grpcservice2 via a k8-service (headless). The way I make a grpc connection object is like this:

	svcurl := "lenses-sharded-worker-10-0-us-east-1a:9090"
	dnsSvcUrl := "dns:///" + svcurl

	pconn1, err := grpc.Dial(dnsSvcUrl, grpc.WithInsecure(), //nolint:staticcheck
		grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy": "round_robin"}`)) //nolint:staticcheck

	cliUsingSvc := pbsearch.NewProductServiceClient(pconn1) // passed the connection object to grpc generated stub for grpcservice2

I have 8 server pods for grpcservice2. When i do k describe <service> I can also see 8 IPs being exposed in the output hence I am assuming that grpc client internally should continue load-balance traffic equally on all of the 8 pods. But when check the cpu-utilzation of those 8 pods, I see only 3 of them heavy utilized and not the other 5. (see screenshot)

image

I researched a bit before and hence was using "dns:///" prefix to enable load-balancing but seems like its not working 100% correctly. Sometime back it was working but not anymore. Even the nslookup of the k8-service gives back 8 ip-address.

Can someone suggest what to try next or solve it?

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