2

We have a gRPC dotnet core service running on Kubernetes behind Nginx. The service has bidirectional streaming endpoint. The ingress is configured with grpc_read_timeout, grpc_send_timeout & client_body_timeout as per documentation to allow the connections to be kept open. Here is the partial ingress definition:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: api-ingress
  namespace: message-api
  labels:
    App: message-api
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/backend-protocol: GRPC
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    nginx.ingress.kubernetes.io/server-snippet: |
      client_body_timeout 360s;
      grpc_read_timeout 360s;
      grpc_send_timeout 360s;

There is a gRPC dotnet client app that consumes this gRPC service and uses SocketsHttpHandler so that it can send KeepAlive pings during inactivity period.

From the Nginx debug logs we can see that keepalive pings are being sent from client but the server resets stream when grpc_read_timeout / grpc_send_timeout is reached during period of inactivity. We tried the client without enabling keepalive pings and the behaviour is still the same, connection remains open until read/send timeout is reached. Therefore keepalive pings seem to be adding no value.

My understanding / assumption was that if we keep sending keepalive pings, the server should not reset stream. Not sure if we have some configuration / implementation issue or if we are misinterpreting & this is by design?

Any pointers / help is much appreciated. Thanks.

4

0 回答 0