Chris G.
Chris G.

Reputation: 25964

grpc-go over https: failed rpc error: code = Unavailable desc = transport is closing:

Note: This is running in containers in Kubernetes.

I have successfully done this very short description: https://knative.dev/docs/serving/samples/grpc-ping-go/

Success:

2019/05/08 13:43:56 Ping got hello - pong
2019/05/08 13:43:56 Got pong 2019-05-08 13:43:57.646935391 +0000 UTC m=+1.661567121

But if I run through 443 from a Gateway on knative setup for https, it does not work:

docker run -ti --entrypoint=/client docker.io/{username}/grpc-ping-go \
  -server_addr="${SERVICE_IP}:443" \
  -server_host_override="${SERVICE_HOST}" \
  -insecure

2019/05/08 13:50:28 &{0xc00012e000}.Ping failed rpc error: code = Unavailable desc = transport is closing: 

The client code from the sample, and the server code. The server is not listening for tls, but the connection to the server is over https.

Just to make sure, I know the https is worning from a simpel hello-go text reply.

Upvotes: 3

Views: 8908

Answers (1)

Frank Bryce
Frank Bryce

Reputation: 8446

In your server code, you are not listening on port 443, so this is most likely the reason your example isn't working.

If you want to keep using http and not https, then your code is working just fine.

If you want to get it working with TLS, this overview is a pretty good one.

To get port 80 to redirect to port 443 (I highly recommend it if you are using https), see this SO post.

Upvotes: 3

Related Questions