cannot connect to azure sql database from AKS pod

John Green 1 Reputation point
2021-10-29T02:19:34.54+00:00

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 Database
Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,852 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Alberto Morillo 32,886 Reputation points MVP
    2021-10-29T02:58:11.517+00:00

    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.

    0 comments No comments

  2. John Green 1 Reputation point
    2021-10-29T05:45:10.673+00:00

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

    0 comments No comments