gRPC client side load balancing

后端 未结 3 1300
死守一世寂寞
死守一世寂寞 2021-02-05 08:20

I\'m using gRPC with Python as client/server inside kubernetes pods... I would like to be able to launch multiple pods of the same type (gRPC servers) and let the client connect

3条回答
  •  一个人的身影
    2021-02-05 08:32

    If you've created a vanilla Kubernetes service, the service should have its own load-balanced virtual IP (check if kubectl get svc your-service shows a CLUSTER-IP for your service). If this is the case, DNS caching should not be an issue, because that single virtual IP should be splitting traffic among the actual backends.

    Try kubectl get endpoints your-service to confirm that your service actually knows about all of your backends.

    If you have a headless service, a DNS lookup will return an A record with 10 IPs (one for each of your Pods). If your client is always choosing the first IP in an A record, that would also explain the behavior you're seeing.

提交回复
热议问题