Introduction
This article details the deployment of a SQL Server Always On Availability Group in Azure Kubernetes Service using DxEnterprise’s DxOperator feature and Rancher Prime. This is the fastest and easiest approach to deploy highly available SQL Server containers. It helps IT pros overcome the inherent complexity of Kubernetes with deployment automation and an easy-to-use management interface, and it unlocks a direct path to the industry’s lowest downtime for SQL Server in Kubernetes.
Prerequisites
- A target Kubernetes cluster with at least two nodes, managed by Rancher or Rancher Prime by SUSE. The Kubernetes cluster must have the ability to provision dynamic persistent volume claims (such as with Longhorn).
- A valid DxEnterprise license with Availability Group management features and tunnels enabled.
- An Internet connection
Installation
Install the DxOperator chart
- Log into Rancher via the web UI.
- Select the top-left hamburger menu, then select the managed cluster into which you want to install DxOperator.
- In the left-hand menu, select App > Charts.
- In the list of available charts, select DxOperator.
- Install the chart.
- Select Install in the top-right corner.
- Select Next in the bottom-right, then Install.
- Wait for the installation to complete before proceeding.
Install the DxOperator – DxE + SQL Server AG chart
- Add Kubernetes secrets for SQL Server and the DxEnterprise cluster passkey.
- In the left-hand menu, select Storage > Secrets.
- Select Create in the top-right corner.
- Select Opaque option.
- Name the secret dxe.
- Enter a key name as DX_PASSKEY with the value of your DxEnterprise cluster passkey.
- Select Add.
- Enter a key name as DX_LICENSE with the value of your DxEnterprise license key. A developer key can be obtained at https://dh2i.com/trial/.
- Select Create in the bottom-right corner.
- Select Create in the top-right corner.
- Select Opaque option.
- Name the secret mssql.
- Enter a key name as MSSQL_SA_PASSWORD with a value of a strong SA password. Please note that your password must meet SQL Server password requirements, or the container deployment will fail. See the SQL Server Password Policy for more details.
- Select Create in the bottom-right corner.
- In the left-hand menu, select Apps > Charts.
- In the list of available charts, select DxOperator – DxE + SQL Server AG.
- Install the chart.
- Select Install in the top-right corner.
- Select Customize Helm options before install checkbox.
- Select Next in the bottom-right.
- Enter CONTAINED for the Availability Group Options.
- Select Create Load Balancers checkbox to allow external access.
- Select DxEnterprise edit options.
- Select Accept EULA checkbox.
- Select dxe for Cluster Secret.
- Select SQL Server edit options.
- Select Accept EULA checkbox.
- Select mssql for SQL Secret.
- Select Next in the bottom-right.
- Select Install in the bottom-right.
Validation
After the installation is complete, you can connect to your Availability Group and the DxEnterprise cluster using SQL Server Management Studio (SSMS).
- Get external IP address of the primary pod.
- In the left-hand menu, select Services.
- Select dxenterprisesqlag-0-lb.
- Make note of the Load Balancer IP address.
- View the Availability Group using SSMS.
- Launch SSMS.
- Connect to the SQL Server instance using the load balancer IP address of the primary pod and the SQL Server SA password.
- In the SSMS Object Explorer, expand Always On High Availability > Availability Groups.
- Right-click on AG1 and select Show Dashboard.
- Browse the Availability Group details pane.
- Simulate system failure to observe automatic failover.
- In the left-hand menu, select Workloads > Pods.
- Select the running dxenterprisesqlag-0 pod.
- Select Delete, the Delete again when prompted.
- Get external IP address of the secondary pod.
- In the left-hand menu, select Services.
- Select dxenterprisesqlag-1-lb.
- Make note of the Load Balancer IP address.
- View the Availability Group using SSMS.
- Connect to the SQL Server instance using the load balancer IP address of the secondary pod and the SQL Server SA password.
- In the SSMS Object Explorer, expand Always On High Availability > Availability Groups.
- Right-click on AG1 and select Show Dashboard.
- Browse the Availability Group details pane.
- Notice that the secondary is now the primary replica for the SQL Server Availability Group.
Summary
DxOperator is a powerful extension to Kubernetes that uses custom resource definitions to automate the deployment of DxEnterprise clusters. DxEnterprise then provides all of the instrumentation to create, configure, manage and provide automatic failover for Microsoft SQL Server Availability Group workloads in Kubernetes. With Rancher, deploying a fully operational DxEnterprise + SQL Server Availability Group requires just a few clicks, and can be completed in seconds. Once deployed, DxEnterprise will ensure that automatic failover is carried out if the SQL Server Availability Group container encounters any system failures.