<p>We have a weird networking issue.</p>
<p>We have a Hyperledger Fabric client application written in Node.js running in Kubernetes which communicates with an external Hyperledger Fabric Network.</p>
<p>We randomly get timeout errors on this communication. When the pod is restarted, all goes good for a while then timeout errors start, sometimes randomly fixed on its own and then goes bad again.</p>
<p>This is Azure AKS, we setup a quick Kubernetes cluster in AWS with Rancher and deployed the app there and same timeout error happened there too.</p>
<p>We ran scripts in the same container all night long which hits the external Hyperledger endpoint both with cURL and a small Node.js script every minute and we didnt get even a single error.</p>
<p>We ran the application in another VM as plain Docker containers and there was no issue there.</p>
<p>We inspected the network traffic inside container, when this issue happens, we can see with netstat a connection is established but tcpdump shows no traffic, no packages are even tried to be sent.</p>
<p>Checking Hyperledger Fabric SDK code, it uses gRPC protocol buffers behind the scenes.</p>
<p>So any clues maybe?</p>

r a f t
<p>This turned out to be not Kubernetes but dropped connection issue.</p>

<p>gRPC keeps connection open and after some period of inactivity intermediary components drop the connection. In Azure AKS case this is the load balancer, as every outbound connection goes through a load balancer. There is a non configurable idle timeout period of 4 minutes after which load balancer drops the connection.</p>

<p>The fix is configuring gRPC for sending keep alive messages.</p>

<p>Scripts in the container worked without a problem, as they open a new connection every time they run.</p>

<p>Application running as plain Docker containers didnt have this issue since we were hitting endpoints every minute hence never reaching idle timeout threshold. When we hit endpoints every 10 minutes, timeout issue also started there too. </p>
