添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account Connection to server failed: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp <minikube ip>:9090: connect: connection refused" #9063 Connection to server failed: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp <minikube ip>:9090: connect: connection refused" #9063 Himanshuxone opened this issue Aug 22, 2020 · 9 comments

Steps to reproduce the issue:

  • create a grpc server running using grpc port flag / environment variables
  • connect mysql local database using service without selector.
  • create a client in local to connect to running grpc server on minikube service.
  • Full output of failed command:

    => grpc server is running on pods and created a database connection.

    Error

    Connection to server failed: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp 192.168.5.173:9090: connect: connection refused

    Note:- error comes when I try to run a client from localhost to connect to grpc running server as Kubernetes service.

    Full output of minikube start command used, if not already included:

    minikube service is running properly only unable to access using go grpc client from local system

    Optional: Full output of minikube logs command:

    grpc server command running on minikube:-
    go run cmd/server/main.go -grpc-port=9090 -db-host=127.0.0.1:3306 -db-user=$USER -db-password=$password -db-schema=$database

    grpc client to access server running on minikube:-
    go run cmd/client-grpc/main.go -server=$(minikube ip):9090

    yojake42, xb3sox, oskiegarcia, linhkid, chenquzhao, nhiddog, felipessz, and sushant8421 reacted with thumbs up emoji sushant8421 reacted with heart emoji All reactions

    In my case the server host variable defaulted to localhost.
    Setting the server to listen on 0.0.0.0 fixed the issue. (listen / allow for any ip)

    when i checked netstat, the server was set up to listen on 0.0.0.0.

    I am using kind, but had the same problem. localhost was the culprit.

    This fixed it for me.

    net.Listen("tcp", ":9090")
              

    Making the GRPC server listen to 0.0.0.0 instead of localhost fixed the 'Connection Refused' error in my case. This issue happened only when I created the server inside a kubernetes pod.

    'localhost' works fine when running the server directly on the host machine.