GKE "Connection reset by peer" when Accessing SQL Server Database

I’ve set up a public GKE cluster and deployed my .NET 5 application, yet I seem to be having an issue accessing our SQL database which is located on another server.

All the pages load correctly until I hit a page that requests data from the SQL server!

The trouble is, I am only getting this generic error message when I access the page:

Error: Server Error
The server encountered a temporary error and could not complete your request. 
Please try again in 30 seconds.

When I look at the logs for the service, I see this "Connection reset by peer" error:

An unhandled exception has occurred while executing the request.
System.Net.Http.HttpRequestException: An error occurred while sending the request.
System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
System.Net.Sockets.SocketException (104): Connection reset by peer

I’ve researched that error a bit but I cannot find any relevant info as to why it might be happening or how to fix it.

Maybe there is a firewall rule I need to add in GKE somewhere?

Is there some special setup required for connecting to a SQL server from a GKE cluster running a .NET 5 app?

Source: Docker Questions

LEAVE A COMMENT