I am trying to deploy ASP .Net Core Web API 3.0 in Azure Kubernetes. My Dot Net Core Web API connects to Azure SQL Database. Here are the configuration
connection string
"ConnectionString": "Server=myservername,1433;Initial Catalog=mydbname;Persist Security Info=False;User ID=userid;Password=*******;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
Deployment and Service yaml file
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-web-api
labels:
app: my-web-api
spec:
replicas: 2
minReadySeconds: 45
selector:
matchLabels:
app: my-web-api
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: my-web-api
spec:
containers:
- name: my-web-api
image: myazureregistry/myapi:latest
imagePullPolicy: Always
ports:
- containerPort: 80
- containerPort: 443
- containerPort: 1433
volumes:
- name: secrets
secret:
secretName: secret-appsettings1
---
apiVersion: v1
kind: Service
metadata:
name: my-web-api
labels:
app: my-web-api
spec:
type: LoadBalancer
ports:
- name: port-8080
port: 8080
targetPort: 80
- name: port-1433
port: 1433
targetPort: 1433
selector:
app: my-web-api
error
Microsoft.Data.SqlClient.SqlException (0x80131904): 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 am new to AKS and Kubernetes. Could some one provide solution for this one, please?
User contributions licensed under CC BY-SA 3.0