DH2i Blog Article

DxOperator – SQL Server Operator for Kubernetes

OJ Ngo
/
February 6, 2024

What is Kubernetes Operator?

Kubernetes operator is a custom controller that extends Kubernetes functionalities. Operator is responsible for managing pods, services, containers, volumes, and other system resources. Operator automates tasks and manages complex applications in Kubernetes.

Learn about the architecture of a standard Kubernetes Operator.

Kubernetes operator uses custom resources (CR) to manage applications and their components. The Kubernetes operator translates the high-level directives provided by the users within a CR into the low-level actions, based on best practices embedded within the operator’s logic.

Introducing DxOperator

DxOperator is a Kubernetes operator that uses custom resource definitions to automate the deployment of DxEnterprise clusters. DxEnterprise then provides all the instrumentation to create, configure, manage, and provide automatic failover for Microsoft SQL Server availability group workloads in Kubernetes.

Sidecar container deployment of SQL Server AG in Kubernetes.

What can you do with DxOperator?

DxOperator gives you full control of how your SQL instances and availability groups are configured and function to support your production workloads. In collaboration with the Microsoft SQL Server team, we have committed the following list of features in this DxOperator version. To see how you can deploy Always on Availability Groups for SQL Server containers on Kubernetes – The DxOperator way, head over to @Amit’s blog.

Custom Pod name

Pod name is a part of the Kubernetes metadata used to identify the deployed pod(s).

Custom pod name

Assigning pods to nodes

DxOperator supports node selection for pods as defined by Kubernetes guidance.

Assigning pods to nodes

Assigning pods to nodes using node affinity

To schedule a pod based on the node affinity, apply the Kubernetes guidance in the CR.

Assigning pods to nodes using node affinity

SQL availability group name and cluster type

Define appropriate name for the SQL availability group that best fits your application or environment. Cluster type can also be specified. Valid values for cluster type are EXTERNAL (automatic failover) and NONE (no automatic failover).

SQL availability group name and cluster type

SQL availability group replicas

Specify the desired synchronous, asynchronous, and/or configuration_only replicas for the deployment. Please note that configuration_only replica is only supported when the cluster type is EXTERNAL.

SQL availability group replicas

SQL availability group options

For SQL Server 2022, DxOperator provides additional options (with) to apply when creating SQL availability groups, including CONTAINED. You can refer to Microsoft documentation for the available options for your version of SQL Server deployment.

SQL availability group options

SQL availability group listener port

Specify the listener port for the SQL availability group.

SQL availability group listener port

Pod load balancer

As part of the deployment of the pod(s), an external load balancer may need to be created to allow external access to the pod(s) running inside Kubernetes. Specify if a load balancer is to be created.

Pod load balancer

Custom Pod annotations

Annotations are key-value pairs associated with the deployed resources, used to provide further information about the resources.

Custom Pod annotations

DxEnterprise container specification

Specify desired container image, image pull policy, EULA acceptance, Kubernetes secret, and whether to join an existing DxEnterprise cluster. If joining an existing cluster is desired, the DX_OTPK value must be present in the Kubernetes secret.

DxEnterprise container specification

SQL Server container specification

Specify desired container image, image pull policy, EULA acceptance, product ID/edition, Kubernetes secret, and config map name.

SQL Server container specification

User-defined volume class

Depending on workload, it may be necessary to assign dedicated storage for each of the containers. DxOperator supports user-defined volume class for each of the desired containers.

User-defined volume class

Quality of Service (QoS)

When deploying production grade applications in Kubernetes, it is important to set the desired QoS for each of the containers to ensure that the container performs within desired metrics. DxOperator supports QoS through the following parameters.

Quality of Service (QoS)

Additional side-car containers

DxOperator allows any additional container(s) to be deployed along with DxEnterprise and SQL Server as side-car container(s). An example of such a side-car container is mssql-tools.

Additional side-car containers

ConfigMap

The ConfigMap object supports SQL Server specific mssql-conf settings to be defined. Any data defined here is copied into the mssql instance’s mssql.conf file.

ConfigMap

Final word

DxOperator is a powerful toolset. With DxOperator, you can easily and quickly deploy any SQL availability group instances in Kubernetes, with any desired specifications and parameters of your choosing. To get started with DxOperator, head over to https://dh2i.com/dxoperator/, sign up for a DxEnterprise developer license, download the quick start guide, and take DxOperator for a spin.

If you’re interested in learning more about DH2i’s approach to smart high availability technology, get signed up for a one-on-one demo today.

The author
OJ Ngo

Native. Containerized. Anywhere in Between.

DH2i gets you closer to zero downtime.