gRPC & WebSockets
Non-HTTP protocols such as gRPC and WebSockets require explicit configuration to work with Knative.
gRPC uses HTTP/2 as its transport, which requires marking the container
port specifically as
h2c (which means unencrypted
If you have a gRPC server app, make sure:
- it listens on port number specified by
PORTenvironment variable passed by Knative (though, you would be specifying its value in your KService manifest)
- doesn't terminate/encrypt TLS inside the gRPC server (non-encrypted is OK )
On the client side, to invoke this gRPC server hosted on Knative:
- use full hostname (either internal or external domain)
- connect to the host over port
You can find a sample Go gRPC application here.
Read more about how gRPC calls are load balanced on Knative.
Follow the tutorial here.