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
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.