I deployed a grpc service on eks and expose the service using ingress. I deployed an demo https app, it worked. However, I have a problem with the grpc app. The service is running but when I log the service I get an error.
The grpc request does not even go to the server. The log is as following
level=info msg="grpc: Server.Serve failed to create ServerTransport: connection error: desc = \"transport: http2Server.HandleStreams received bogus greeting from client: \\"GET / HTTP/1.1\\r\\nHost: 19\\"\"" system=system
It seems it should receive http2 but it just has HTTP/1.1
??
For ingress I tried
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:xxxx
alb.ingress.kubernetes.io/load-balancer-attributes: 'routing.http2.enabled=true'
for service.yml
annotations:
service.alpha.kubernetes.io/app-protocols: '{"grpc":"HTTP2", "http": "HTTP2"}'
For the service deployed it seems fine. Once I have ingress deployed it keeps have the error above.
Not sure if Ingress supports HTTP2/gRPC. If you are using GKE, you could try ESP
I use Istio service mesh to solve this problem. Istio virtual service can route HTTP1.1 HTTP2 GRPC traffic By setting service port name to grpc or prefixing it with grpc-. Istio will configure the service with HTTP2 protocol