question

JohnGreen-2077 avatar image
0 Votes"
JohnGreen-2077 asked JohnGreen-2077 answered

cannot connect to azure sql database from AKS pod

under the firewall settings for the sql server, I have "Allow Azure services and resources to access this server" set to Yes, and added the vnet the cluster is on. is there a way to see what the problem with the connection is from the server side? logs view doesn't have any information.

Completed 500 Internal Server Error in 81ms (Allocations: 758)
F, [2021-10-28T20:16:43.601878 #1] FATAL -- : [fcf42f1ff0b473b9ec2e739afc2e9265]
[fcf42f1ff0b473b9ec2e739afc2e9265] ActiveRecord::ConnectionNotEstablished (server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
):

telnet shows 1433 open but the connection closes after a short moment. nslookup seems to show the dns resolving correctly too.

forgot to mention, it's a rails app if that provides any useful context. all db connection information from the env are confirmed to be what is intended

azure-sql-databaseazure-kubernetes-service
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AlbertoMorillo avatar image
0 Votes"
AlbertoMorillo answered

Create a VNet Rule on the Azure DB Server that allows access from the subnet the AKS nodes are in. This is used in conjunction with the Microsoft.Sql VNet Service Endpoint enabled on the cluster subnet. VNet Rules allows granting access to an entire subnet of AKS nodes.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JohnGreen-2077 avatar image
0 Votes"
JohnGreen-2077 answered

I think my issue was assuming the Azure SQL database service was postgresql. Thanks regardless

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.