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
- DxOperator installed and a SQL Server Availability Group created in the Kubernetes cluster.
Creating an Availability Group Listener
-
Assign the
availabilityGroupListenerPort.- kubectl
- Helm
Update the following value in the
DxSqlAg.yamlfile:DxSqlAg.yamlspec:
sqlAgConfiguration:
availabilityGroupListenerPort: 14033Apply the file:
kubectl apply -f DxSqlAg.yamlUpdate the
values.yamlwith the following:sqlAgConfiguration:
availabilityGroupListenerPort: 14033Upgrade the chart.
helm upgrade -f values.yml dxsqlag dh2i/dxsqlag -
In the DxSqlAg
spec, uncomment the entry for the AG Listener. -
Apply the service YAML to add a load balancer for the listener.
infoMake sure to set the selector to
dh2i.com/entity: <DxSqlAg_name>, using the name that was applied in theDxSqlAg.yamlabove.Example Load Balancer ServiceapiVersion: 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 -
Verify the load balancer assignments.
kubectl get services