3
votes

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.

1
is your go program server tls?Pizza lord
Thanks and no the server is not tls but the connection is over https - just updated the question.Chris G.
you can not have a https connection with a server that does not support https ...Pizza lord
Ok thanks, so if I start a go server with tls it should work?Chris G.
yep that should workPizza lord

1 Answers

3
votes

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.