<p>I have a dotnet core pod in Kubernetes(minikube) that need to access to local SQL Server(Testing Server). 
it work in the container but when i put it in to pod. it can't fine sql server on my machine</p>

<p>but i can ping from pod to my SQL Server</p>

<p>here is the error from log</p>

<pre><code> An error occurred using the connection to database
&gt; 'ArcadiaAuthenServiceDB' on server '192.168.2.68'.
&gt; System.Data.SqlClient.SqlException (0x80131904): A network-related or
&gt; instance-specific error occurred while establishing a connection to
&gt; SQL Server. The server was not found or was not accessible. Verify
&gt; that the instance name is correct and that SQL Server is configured to
&gt; allow remote connections. (provider: TCP Provider, error: 40 - Could
&gt; not open a connection to SQL Server)  
</code></pre>

<p>ping</p>

<pre><code>root@authenservice-dpm-57455f59cf-7rqvz:/app# ping 192.168.2.68
PING 192.168.2.68 (192.168.2.68) 56(84) bytes of data.
64 bytes from 192.168.2.68: icmp_seq=1 ttl=127 time=0.449 ms
64 bytes from 192.168.2.68: icmp_seq=2 ttl=127 time=0.361 ms
64 bytes from 192.168.2.68: icmp_seq=3 ttl=127 time=0.323 ms
64 bytes from 192.168.2.68: icmp_seq=4 ttl=127 time=0.342 ms
^C
--- 192.168.2.68 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3064ms
rtt min/avg/max/mdev = 0.323/0.368/0.449/0.053 ms
root@authenservice-dpm-57455f59cf-7rqvz:/app# 
</code></pre>

<p>my Connection String in  Container</p>

<pre><code>"DefaultConnection": "Server=mssql-s; Database=ArcadiaAuthenServiceDB; MultipleActiveResultSets=true;User Id=pbts;Password=pbts"
</code></pre>

<p>I try to Created Service End-point in Kubernetes but no luck.</p>

<p>Thank you.</p>

<p>EDIT
Here The Service.yml File</p>

<pre><code>apiVersion: v1  
     kind: Service  
     metadata: 
         name: mssql-s 
         namespace: default  spec: 
         ports: 
         - port: 1433 
     ---  
     apiVersion: v1  
     kind: Endpoints  
     metadata: 
         name: mssql-s 
         namespace: default  subsets: 
        - addresses: 
        - ip: 192.168.2.68 
         ports: 
         - port: 1433 
     –--
</code></pre>

<p>EDIT 
I check that SQL Server is Listen to 1433 as well</p>

<pre><code>PS C:\Windows\system32&gt; netstat -aon | findstr 1433   
TCP   0.0.0.0:1433           0.0.0.0:0              LISTENING       5028   
TCP   [::]:1433              [::]:0                 LISTENING       5028
</code></pre>

<p>Is there anything i can do to solve this problem?</p>

Peeradis Sa-nguanTrakul
<p>Thank you for all your reply.
Today i found solution. it not about k8s but it about Firewall Setting.
I add Inbound rule to allow port 1433. And That it</p>
