{"id":25669,"date":"2018-12-10T09:00:52","date_gmt":"2018-12-10T17:00:52","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/?p=25669"},"modified":"2022-09-26T09:49:14","modified_gmt":"2022-09-26T16:49:14","slug":"availability-groups-on-kubernetes-in-sql-server-2019-preview","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2018\/12\/10\/availability-groups-on-kubernetes-in-sql-server-2019-preview\/","title":{"rendered":"Availability Groups on Kubernetes in SQL Server 2019 preview"},"content":{"rendered":"

Starting with SQL Server 2017, Microsoft embarked on a journey to support SQL Server deployments on Linux and containers, in order to provide a choice of deployment platform for our customers and partners. With the preview of SQL Server 2019<\/a>, we announced new capabilities for deploying SQL Server with High Availability and Disaster Recovery on containers in Kubernetes. The capability is provided through the new SQL Server Operator for Kubernetes, which provides mechanisms for Always On Availability Groups, adding high availability and disaster recovery capabilities for container deployments of SQL Server.<\/p>\n

Customers today are gravitating towards adopting SQL Server on containers for a plethora of deployment scenarios, including local application development testing for DevOps pipelines and in some cases production deployment. SQL Server containers, orchestrated through container frameworks like Kubernetes, provide a consistent, isolated and reliable behavior alongside providing the ease of usage, deployment, and management. The ability to deploy a SQL Server container with Availability Groups, provides an Enterprise-class HA and DR for these deployments.<\/p>\n

SQL Server 2019 HA Operator<\/h2>\n

The Kubernetes operator for SQL Server is the key component which provides the functionality to deploy, manage and maintain the SQL Server HA deployment. The operator implements and registers the custom resource definition for SQL Server and the Availability Group resources. When the operator is deployed, it registers itself as a listener for notifications about SQL Server resources being deployed in the Kubernetes cluster. When a user creates or updates a SQL Server resource in the cluster a notification is sent to the operator, which then interprets and creates\/updates the corresponding SQL Server object as needed.<\/p>\n

The Docker container image implements the code for the operator and the following additional important binaries:<\/p>\n

    \n
  1. mssql-operator<\/em> – Implements the Kubernetes operator for SQL Server and Availability Groups.<\/li>\n
  2. mssql-server-k8s-health-agent<\/em> \u2013 Implements the logic to determine the health of a SQL Server Instance.<\/li>\n
  3. mssql-ha-supervisor<\/em> \u2013 Implements the AG health detection and management logic, including the leader election logic to determine the Primary replica for the availability group. The leader election functionality is based on a fork of the Kubernetes client leader election.<\/li>\n
  4. mssql-server-k8s-init-sql<\/em> \u2013 Implements the logic for deployment and initialization of a desired state configuration to a SQL Server instance.<\/li>\n<\/ol>\n

    Additional details on the other binaries implements in the HA container image can be found in the Always On availability groups for SQL Server containers documentation<\/a>.<\/p>\n

    Deployment Architecture<\/h2>\n

    The diagram below shows the high-level architecture of the SQL Server HA on Kubernetes.<\/p>\n

    \"DiagramThe diagram\u00a0above includes the following components:<\/p>\n