Mysql deployment on AKS vs Azure database for mysql question

sql user 86 Reputation points
2022-02-15T02:09:21.337+00:00

Hello
I would like to deploy Mysql for an application running on Azure kubernetes service. I would like to decide whether i would go for mysql as a pod as part of AKS or should i use Azure database for mysql as managed service?. I would like to understand the pros and cons for each deployment ?.

Pls help.

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

Accepted answer
  1. shiva patpi 13,251 Reputation points Microsoft Employee
    2022-02-15T06:44:49.09+00:00

    Hello @sql user ,
    Thanks for reaching out to Microsoft Q&A. It's a very good question but there is no straightforward answer. Please read out...

    If you go for MySQL as a POD

    1) As Kubernetes PODs are stateless , you will have to deploy those PODS as a statefulset
    2) You will have to create corresponding PV , PVC & use the storage classes.
    3) Those statefulset should pods should be backed by a Managed Disk ( This is one of typical approach to setup persistent storage in an Azure cloud environment is to use Azure Managed Disks. So, when its pod is terminated and recreated, the data can be re-attached to the MySQL pod. They are attached to only one VM Node where its containing pods can only read/write to. As a result, there is relatively tighter security and lower latency between the VM Node and Azure Managed Disk. )
    4) If the application is running in AKS and if the database needs to be accessed only by that running application - this will be the preferred approach !
    5) Deployments wise it's easily manageable using YAML files and scalable depending upon the load.

    But the availability of the database depends on the AKS cluster resource health

    See the article: https://techcommunity.microsoft.com/t5/azure-database-for-mysql-blog/provisioning-azure-database-for-mysql-single-server-from-aks/ba-p/2695317

    To gain the benefits of using a MySQL database in a Kubernetes application, one of the common strategies is to provision the database in a container running in a pod. In doing so, the database will use the cluster resources. Accessing the database from other pods in the same AKS cluster running client apps is possible via Kubernetes networking. However, if for some reason cluster resources become unavailable, both the application and the database will be unavailable, as both rely on cluster health.

    Using Azure database for mysql is one of the simplest options for sure!

    To address the issue of cluster resources being shared between the application and database, you can substitute the local database in AKS with Azure Database for MySQL, which separates the database from the AKS cluster. Thus, cluster resources will remain focused on delivering infrastructure required to run the app and database availability will not be impacted by AKS availability.

    Read out the below complete article:-
    https://irp-cdn.multiscreensite.com/61571848/files/uploaded/Azure%20Database%20for%20MySQL%20and%20Azure%20Kubernetes%20Service_c9j3WTi8R9qC6rWHsAZ5.pdf
    https://roykim.ca/2020/05/19/database-patterns-with-azure-kubernetes-service-part-1-mysql-azure-managed-disk/

    Also consider the pricing factors for Azure SQL PAAS DB Service: https://azure.microsoft.com/en-in/pricing/details/mysql/server/

    Let us know if that helps in taking a decision!

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.