Connect to Basic Mysql from AKS Nodejs Pod

James Bissett 1 Reputation point

I have defined an external Service in AKS as below

apiVersion: v1
kind: Service
  name: mysql
  namespace: mySpace
  type: ExternalName

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.
712 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,852 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. shiva patpi 13,131 Reputation points Microsoft Employee

    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.

    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

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