Locally, bare-metal, two separate 'services' successfully talk to each other trough a gRPC connection, a client and a 'backend'. Both are implemented as NestJS apps, using the gRPC transports.
When deployed in kubernetes(minikube) environment I get Error: 14 UNAVAILABLE: No connection established
in the client. Backend listens on localhost:50051
(port is exposed from k8 service), frontend attempts connection on engine-svc.default.svc.cluster.local:50051
, where the first part up until the dot is the service name and I've nslookup
'd it to make sure this is the full domain name.
I tried port-forwarding to the gRPC kubernetes service, this 'backend' part of the connection works fine and communication to/from it works. Thus the 'frontend' deployment/pods is the part to fail establishing a connection.
Minikube comes packaged with coreDNS. I've tried debugging it but without success. When the 'frontend' service attempts to connect, the logs from coreDNS are labeled with NOERROR
which I've read means the service is found; still it remains unsuccessfull.
What else could be an issue? What am I missing? Any help is greatly appreciated.
CodePudding user response:
Solved my problem thanks to this answer. The problem was that the backend was listening on localhost:50051
which means local connections only; port-forwarding also counts as one so that's why it worked. Changing the 'listen on' property to 0.0.0.0:50051
on the backend part solved the issue;