Run .net core 1.1 test in kubernetes cluster and connect to google compute engine VM's SQL Server

8/28/2017

I have .NET Core 1.1 Test project and I am building this project inside kubernetes pods using VSTS linux agent. In one of tests, I am trying to connect to SQL Server (installed inside one VM in Google Compute Engine). Whenever this test executes (with dotnet test command), I am getting below exception

**System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)****

I have tried below options in Google Compute Engine's VM 1. Pinged it with public IP address - working 2. SQL services are running - verified with SQL Server configuration manager 3. TCP/IP and Named Pipes protocols and port are enabled in configuration manager 4. Remote connections to the server is allowed (thru SQL Server Management Studio)

But still getting the same exception

-- Abhay
.net-core
google-compute-engine
kubernetes
sql-server

1 Answer

9/8/2017

This problem is resolved now...the issue was my kubernetes build cluster was in some other network and my google compute engine's VM was in default network..Once I changed network of VM..it started working

-- Abhay
Source: StackOverflow