| title | SQL Server Always On availability group Kubernetes specification |
|---|---|
| description | This article explains the parameters for the SQL Server Kubernetes Always On availability group specification |
| author | MikeRayMSFT |
| ms.author | mikeray |
| manager | craigg |
| ms.date | 08/09/2018 |
| ms.topic | article |
| ms.prod | sql |
| ms.component | |
| ms.suite | sql |
| ms.custom | sql-linux |
| ms.technology | linux |
| monikerRange | >=sql-server-ver15||>=sql-server-linux-ver15||=sqlallproducts-allversions |
To configure an Always On availability group on Kubernetes, create a specification. The specification is a .yaml file.
This article shows how to create the specification, and explains the parameters the parameters. See an example of the of the end-to-end deployment in this tutorial.
The following example of a manifest file describes a Kubernetes specification for SQL Server. Copy the contents of the example into a new file named sqlservers.yaml to create the SQL Server availability group StatefulSet in Kubernetes.
[!INCLUDEkubernetes-ag-sql-statefulset-yaml]
To deploy the SQL Server instances and create the availability group, run the following command.
kubectl apply -f sqlservers.yaml
-
sqlServerContainer- Required
- Description: SQL Container spec. Should at least contain image path. In addition, it can have any env variable available for SQL Server container.
- Example
sqlServerContainer: image: private-repo.microsoft.com/mssql-private-preview/mssql-server
-
saPassword- Required
- Description: The
sapassword for the sql server. Sets the initial password for the SQL Server instance. Changing this password through this field is not supported. Rotate the password instead. - Example
saPassword: secretKeyRef: name: sql-secrets key: sapassword
-
masterKeyPassword- Required
- Description: The server master key password for sql server. Used and for db mirroring certificates, logins, and passwords. It is regeneratable. You can change it post-deployment. DB mirroring logins are generated automatically as well.
- Example
masterKeyPassword: secretKeyRef: name: sql-secrets key: masterkeypassword
-
agentsContainerImage- Required
- Description: The Agent container image name.
- Example
agentsContainerImage: private-repo.microsoft.com/mssql-private-preview/mssql-server-k8s-agents
-
acceptEula- Required
- Description: Boolean acceptance of the SQL Server EULA.
- Example
acceptEula: true
-
instanceRootVolume- Required if
instanceRootVolumeClaimTemplateis not present. - Description: Volume source for the sql server container. For more information, see Kubernetes storage volumes.
- Example
instanceRootVolume: persistentVolumeClaim: claimName: <claim name>
- Required if
-
instanceRootVolumeClaimTemplate- Required if
instanceRootVolumeis not present. - Description: Persistent Volume claim template for instance root Kubernetes storage persistent volumes.
- Required if
-
pid- Optional
- Description: The SQL Server edition or product key. Defaults to Developer edition. See Environment variables.
-
monitorPolicy- Optional
- Description: Integer health level used with
sp_server_diagnosticsto trigger failovers. Minimum: 0. Maximum: 5. Same semantics as monitor policy levels in Pacemaker/WSFC. 2 does not exist in Linux.
-
sqlServerPod- Optional
- Description: Pod spec with overrides for the SQL Server StatefulSet pod. Used when you use a private image. For more information, see Kubernetes pods.
-
initSQLPod- Optional
- Description: Pod spec with overrides for the init-sql job pod. Used when you use a private image.
-
connectionTimeoutSec- Optional
- Description: Connection time out in seconds for the AG agents to connect to SQL Server. Minimum: 1 second. Default: 30 seconds.
-
queryCommandTimeoutSec- Optional
- Description: The generic SQL query command time out in seconds for waiting for data from a query. Minimum: 1. Default value: 10.
-
joinCommandTimeoutSec- Optional
- Description: The sql query command time out in seconds for waiting for data from a longer
ALTER AVAILABILITY GROUP <group_name> JOIN;. Minimum: 1. Default value: 60. Recommended minimum is 60.
-
transientDBHealthTimeoutSec- Optional
- Description: Time out in seconds to wait for transient database states to come online after becoming the primary before triggering a failover. Minimum: 1. Default: 180. Used when
db_failoverisON. Kubernetes Availability Group is always created with this settingON, it can be updated toOFF.`
-
sqlPostInitScript- Optional
- Description: Post initialization script to run after every update of the Kubernetes custom resource. Operations that use the post initialization script include:
- resource create
- resource change property
- resource upgrade
-
availabilityGroups- Optional
- Description: List of availability groups the server is a part of and the server replica mode.
- Example
availabilityGroups: name: <availabilityGroupName> availabilityMode: <synchronousCommit | asynchronousCommit | configurationOnly>