Connect to Basic Mysql from AKS Nodejs Pod

James Bissett 1 Reputation point
2020-12-03T14:29:26.623+00:00

I have defined an external Service in AKS as below

apiVersion: v1
kind: Service
metadata:
  name: mysql
  namespace: mySpace
spec:
  type: ExternalName
  externalName: myDb.mysql.database.azure.com

then in my node app attempt to access by

mySqlConnection = mysql.createPool({
          host: mysql.mySpace.svc,
          port: 3306,
          user: myUser,
          password: myPass,
          database: myDB,
          waitForConnections: true,
          connectionLimit: 10,
          queueLimit: 0,
          multipleStatements: true
        });

but the connection does not seem to go through.
The pod and the Service are both in the same namespace.
I have also turned off ssl and allowed access from Azure Services in the portal ( This is only temporary for testing).
I have another Mysql running in the cluster, which I can connect to with no problems (i want to replace this instance with the MySql Paas)
I understand the connection options are limited in the basic deployments but I would rather not drive up my cots at the moment to upgrade to GP or Mem Opt at the moment.
Any help would be appreciated.
Thank you in advance.

Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
719 questions
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,878 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. shiva patpi 13,141 Reputation points Microsoft Employee
    2020-12-03T20:04:13.457+00:00

    Hello @James Bissett ,
    In order for the AKS POD container to communicate to a PAAS SQL Service , it needs a VNET service endpoint followed by a vnet-rule which needs to be added .

    I just tried below git hub document successfully , which talks about an AKS POD communication to MySQL PAAS Service.
    https://github.com/yoshioterada/k8s-Azure-Container-Service-AKS--on-Azure/blob/master/Kubernetes-Workshop9.md

    Able to login to the pod container and perform mysql operations.

    Kindly let me know if you have additional questions.

    0 comments No comments

  2. James Bissett 1 Reputation point
    2020-12-03T20:07:21.817+00:00

    VNET endpoints are not available in Basic, they require General Purpose or Memory Optimised plans.