title: Bridge to Kubernetes Not Working With Grpc Service
body: <p>Does Bridge to Kubernetes works with Grpc services ?<br/>
  I have in Kubernetes a Http gateway which communicates with a grpc service.<br/>
  I'm able to run the gateway project locally via Bridge to Kubernetes and receive http requests sent to the gateway service in the Kubernetes cluster.<br/>
  When running the Grpc service locally via Bridge to Kubernetes, the grpc requests sent to the grpc service in the Kubernetes cluster via the gateway service are not forwarded to my local dev machine.<br/></p>
  <p>On the Kubernetes cluster, looking at the forward pod (the one replacing my real grpc service pod by bridge to kubernetes) logs, I can see it is forwarding on the correct port (5005):</p>
  <pre><code>2021-03-10T10:54:49.5165135Z | RemoteAgent | TRACE | ReversePortForwardConnector created for port 5005\nOperation context: &lt;json&gt;{&quot;clientRequestId&quot;:&quot;ff87d8a3-50cf-40e9-ade6-999cf0134a17&quot;,&quot;correlationId&quot;:&quot;a25c866e-cc5c-4a69-82e4-e144d9411f38:f66d8e62cc62:5a4a2f5120d5&quot;,&quot;requestId&quot;:null,&quot;userSubscriptionId&quot;:null,&quot;startTime&quot;:&quot;2021-03-10T10:54:43.9384338Z&quot;,&quot;userAgent&quot;:&quot;RemoteAgent/1.0.20210126.4&quot;,&quot;requestHttpMethod&quot;:null,&quot;requestUri&quot;:null,&quot;version&quot;:&quot;1.0.20210126.4&quot;,&quot;requestHeaders&quot;:{},&quot;loggingProperties&quot;:{&quot;applicationName&quot;:&quot;RemoteAgent&quot;,&quot;deviceOperatingSystem&quot;:&quot;Linux 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021&quot;,&quot;framework&quot;:&quot;.NET Core 3.1.11&quot;,&quot;processId&quot;:1,&quot;targetEnvironment&quot;:&quot;Production&quot;}}&lt;/json&gt;
  
  2021-03-10T10:54:49.5306948Z | RemoteAgent | TRACE | ReversePortForwardConnector start listening on port 5005
  </code></pre>
  <p>When sending a request to the gateway, I can see the forwarder pod receive the request coming from the gateway, but doesn't forward it to my local dev machine:</p>
  <pre><code>2021-03-10T10:59:51.7216091Z | RemoteAgent | TRACE | AgentHub received for 5005, id 3, size 491
  
  2021-03-10T10:59:53.7781637Z | RemoteAgent | TRACE | AgentHub disconnect for 5005, id 3\nOperation context: &lt;json&gt;{&quot;clientRequestId&quot;:&quot;ff87d8a3-50cf-40e9-ade6-999cf0134a17&quot;,&quot;correlationId&quot;:&quot;a25c866e-cc5c-4a69-82e4-e144d9411f38:f66d8e62cc62:5a4a2f5120d5&quot;,&quot;requestId&quot;:null,&quot;userSubscriptionId&quot;:null,&quot;startTime&quot;:&quot;2021-03-10T10:54:43.9384338Z&quot;,&quot;userAgent&quot;:&quot;RemoteAgent/1.0.20210126.4&quot;,&quot;requestHttpMethod&quot;:null,&quot;requestUri&quot;:null,&quot;version&quot;:&quot;1.0.20210126.4&quot;,&quot;requestHeaders&quot;:{},&quot;loggingProperties&quot;:{&quot;applicationName&quot;:&quot;RemoteAgent&quot;,&quot;deviceOperatingSystem&quot;:&quot;Linux 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021&quot;,&quot;framework&quot;:&quot;.NET Core 3.1.11&quot;,&quot;processId&quot;:1,&quot;targetEnvironment&quot;:&quot;Production&quot;}}&lt;/json&gt;
  
  2021-03-10T10:59:53.7791763Z | RemoteAgent | TRACE | PortForwardConnector.Disconnect 3
  
  2021-03-10T10:59:53.7797928Z | RemoteAgent | TRACE | AgentHub closed for 5005, id 3
  
  2021-03-10T10:59:53.7807672Z | RemoteAgent | TRACE | ReversePortForwardConnector.StartReceiveDataAsync exception 'Unable to read data from the transport connection: Operation canceled.' when invoking handler. Close.
  </code></pre>
  <p>On the gateway side, I see the following logs:</p>
  <pre><code>2021-03-10T11:05:58.056425797Z info: System.Net.Http.HttpClient.RedisLockGrpcServiceClient.LogicalHandler[100]
  2021-03-10T11:05:58.056437689Z       Start processing HTTP request POST http://my.service.name.qa.svc.cluster.local:5005/RedisLockGrpcService.RedisLockGrpcService/AcquireLock
  
  2021-03-10T11:05:58.056506665Z info: System.Net.Http.HttpClient.RedisLockGrpcServiceClient.ClientHandler[100]
  2021-03-10T11:05:58.056513072Z       Sending HTTP request POST http://my.service.name.qa.svc.cluster.local:5005/RedisLockGrpcService.RedisLockGrpcService/AcquireLock
  
  2021-03-10T11:06:00.122757112Z fail: Grpc.Net.Client.Internal.GrpcCall[6]
  2021-03-10T11:06:00.122767931Z       Error starting gRPC call.
  2021-03-10T11:06:00.122771595Z System.Net.Http.HttpRequestException: An error occurred while sending the request.
  2021-03-10T11:06:00.122774131Z  ---&gt; System.IO.IOException: The request was aborted.
  2021-03-10T11:06:00.122776838Z  ---&gt; System.IO.IOException: The response ended prematurely, with at least 9 additional bytes expected.
  2021-03-10T11:06:00.122778929Z    at System.Net.Http.Http2Connection.ReadAtLeastAsync(Stream stream, Memory`1 buffer, Int32 minReadBytes)
  2021-03-10T11:06:00.122781228Z    at System.Net.Http.Http2Connection.EnsureIncomingBytesAsync(Int32 minReadBytes)
  2021-03-10T11:06:00.122797606Z    at System.Net.Http.Http2Connection.ReadFrameAsync(Boolean initialFrame)
  2021-03-10T11:06:00.122800082Z    at System.Net.Http.Http2Connection.ProcessIncomingFramesAsync()
  2021-03-10T11:06:00.122801790Z    --- End of inner exception stack trace ---
  2021-03-10T11:06:00.122803975Z    at System.Net.Http.Http2Connection.Http2Stream.CheckResponseBodyState()
  2021-03-10T11:06:00.122805517Z    at System.Net.Http.Http2Connection.Http2Stream.TryEnsureHeaders()
  2021-03-10T11:06:00.122807080Z    at System.Net.Http.Http2Connection.Http2Stream.ReadResponseHeadersAsync(CancellationToken cancellationToken)
  2021-03-10T11:06:00.122808600Z    at System.Net.Http.Http2Connection.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
  2021-03-10T11:06:00.122810131Z    --- End of inner exception stack trace ---
  2021-03-10T11:06:00.122811641Z    at System.Net.Http.Http2Connection.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
  2021-03-10T11:06:00.122813161Z    at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
  2021-03-10T11:06:00.122815615Z    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
  2021-03-10T11:06:00.122817242Z    at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
  2021-03-10T11:06:00.122818859Z    at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
  2021-03-10T11:06:00.122820416Z    at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
  2021-03-10T11:06:00.122838745Z    at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
  2021-03-10T11:06:00.122844461Z    at Grpc.Net.Client.Internal.GrpcCall`2.GetResponseHeadersCoreAsync()
  
  2021-03-10T11:06:00.123445505Z info: Grpc.Net.Client.Internal.GrpcCall[3]
  2021-03-10T11:06:00.123451724Z       Call failed with gRPC error status. Status code: 'Internal', Message: 'Error starting gRPC call. HttpRequestException: An error occurred while sending the request. IOException: The request was aborted. IOException: The response ended prematurely, with at least 9 additional bytes expected.'.
  </code></pre>