Skip to main content
Version: v2.0-RC

Create a SQL Server AG Listener

This guide will walk you through how to assign an availability group listener and expose it as a service.

Prerequisites

Creating an Availability Group Listener

  1. Assign the availabilityGroupListenerPort.

    Update the following value in the DxSqlAg.yaml file:

    DxSqlAg.yaml
    spec:
    sqlAgConfiguration:
    availabilityGroupListenerPort: 14033

    Apply the file:

    kubectl apply -f DxSqlAg.yaml
  2. In the DxSqlAg spec, uncomment the entry for the AG Listener.

  3. Apply the service YAML to add a load balancer for the listener.

    info

    Make sure to set the selector to dh2i.com/entity: <DxSqlAg_name>, using the name that was applied in the DxSqlAg.yaml above.

    Example Load Balancer Service
    apiVersion: v1
    kind: Service
    metadata:
    name: dxsqlag-cluster-lb
    spec:
    type: LoadBalancer
    selector:
    dh2i.com/entity-name: dxsqlag
    # This label points to whichever pod is the active Vhost member
    dh2i.com/active-vhost-vhost1: true
    ports:
    - name: sql
    protocol: TCP
    port: 1433
    targetPort: 1433
    - name: listener
    protocol: TCP
    port: 14033
    targetPort: 14033
    - name: dxe
    protocol: TCP
    port: 7979
    targetPort: 7979
  4. Verify the load balancer assignments.

    kubectl get services