You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/linux/quickstart-sql-server-containers-azure.md
+17-25Lines changed: 17 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: "Quickstart: Deploy a SQL Server container cluster on Azure"
3
3
description: This tutorial shows how to deploy a SQL Server high availability solution with Azure Kubernetes Service or Azure Red Hat OpenShift.
4
4
author: rwestMSFT
5
5
ms.author: randolphwest
6
-
ms.date: 08/18/2022
6
+
ms.date: 07/31/2023
7
7
ms.service: sql
8
8
ms.subservice: linux
9
9
ms.topic: quickstart
@@ -19,10 +19,10 @@ This quickstart demonstrates how to configure a highly available SQL Server inst
19
19
20
20
This quickstart uses the following command line tools to manage the cluster.
21
21
22
-
|Cluster service|Command line tool|
23
-
|---|---|
24
-
|Azure Kubernetes Service (AKS)|[kubectl](https://kubernetes.io/docs/reference/kubectl/) (Kubernetes CLI)|
25
-
|Azure Red Hat OpenShift|[oc](https://docs.openshift.com/container-platform/4.12/cli_reference/openshift_cli/getting-started-cli.html) (OpenShift CLI)|
22
+
|Cluster service|Command line tool|
23
+
|---|---|
24
+
|Azure Kubernetes Service (AKS)|[kubectl](https://kubernetes.io/docs/reference/kubectl/) (Kubernetes CLI)|
25
+
|Azure Red Hat OpenShift|[oc](https://docs.openshift.com/container-platform/4.12/cli_reference/openshift_cli/getting-started-cli.html) (OpenShift CLI)|
26
26
27
27
## Prerequisites
28
28
@@ -174,28 +174,17 @@ For a database in a Kubernetes cluster, you must use persisted storage. You can
174
174
175
175
### [OpenShift](#tab/oc)
176
176
177
-
For a database in an OpenShift cluster, you must use persisted storage. You can configure a [persistent volume](https://docs.openshift.com/container-platform/4.12/storage/persistent_storage/persistent_storage_local/persistent-storage-local.html) and [persistent volume claim](https://docs.openshift.com/container-platform/4.12/storage/persistent_storage/persistent_storage_local/persistent-storage-local.html#create-local-pvc_persistent-storage-local) in the OpenShift cluster using the following steps:
177
+
For a database in an OpenShift cluster, you must use persisted storage. You can configure a [persistent volume](https://docs.openshift.com/container-platform/latest/storage/persistent_storage/persistent-storage-azure.html) and [persistent volume claim](https://docs.openshift.com/container-platform/latest/storage/persistent_storage/persistent-storage-azure.html#creating-the-persistent-volume-claim) in the OpenShift cluster using the following steps:
178
178
179
179
1. Create a manifest to define the storage class and the persistent volume claim. The manifest specifies the storage provisioner, parameters, and reclaim policy. The OpenShift cluster uses this manifest to create the persistent storage.
180
180
181
-
1. The following YAML example defines a storage class and persistent volume claim. The storage class provisioner is `azure-disk`, because this OpenShift cluster is in Azure. The storage account type is `Standard_LRS`. The persistent volume claim is named `mssql-data`. The persistent volume claim metadata includes an annotation connecting it back to the storage class.
181
+
1. The following YAML example defines a persistent volume claim using the default storage class. The persistent volume claim is named `mssql-data`.
@@ -215,7 +204,6 @@ For a database in an OpenShift cluster, you must use persisted storage. You can
215
204
The persistent volume is automatically created as an Azure storage account, and bound to the persistent volume claim.
216
205
217
206
```output
218
-
storageclass "azure-disk" created
219
207
persistentvolumeclaim "mssql-data" created
220
208
```
221
209
@@ -270,7 +258,7 @@ For a database in an OpenShift cluster, you must use persisted storage. You can
270
258
271
259
The container hosting the SQL Server instance is described as a Kubernetes *deployment object*. The deployment creates a *replica set*. The replica set creates the *pod*.
272
260
273
-
You will create a manifest to describe the container, based on the SQL Server [mssql-server-linux](https://hub.docker.com/_/microsoft-mssql-server) Docker image.
261
+
You create a manifest to describe the container, based on the SQL Server [mssql-server-linux](https://hub.docker.com/_/microsoft-mssql-server) Docker image.
274
262
275
263
- The manifest references the `mssql-server` persistent volume claim, and the `mssql` secret that you already applied to the Kubernetes cluster.
276
264
- The manifest also describes a [service](https://kubernetes.io/docs/concepts/services-networking/service/). This service is a load balancer. The load balancer guarantees that the IP address persists after SQL Server instance is recovered.
@@ -358,7 +346,7 @@ You will create a manifest to describe the container, based on the SQL Server [m
358
346
359
347
When Kubernetes deploys the container, it refers to the secret named `mssql` to get the value for the password.
360
348
361
-
- `securityContext`: Defines privilege and access control settings for a pod or container. In this case it's specified at the pod level, so all containers adhere to that security context. In the security context, we define the `fsGroup` with the value `10001`, which is the Group ID (GID) for the `mssql` group. This value means that all processes of the container are also part of the supplementary GID `10001` (`mssql`). The owner for volume `/var/opt/mssql` and any files created in that volume will be GID `10001` (the `mssql` group).
349
+
- `securityContext`: Defines privilege and access control settings for a pod or container. In this case, it's specified at the pod level, so all containers adhere to that security context. In the security context, we define the `fsGroup` with the value `10001`, which is the Group ID (GID) for the `mssql` group. This value means that all processes of the container are also part of the supplementary GID `10001` (`mssql`). The owner for volume `/var/opt/mssql` and any files created in that volume will be GID `10001` (the `mssql` group).
362
350
363
351
> [!WARNING]
364
352
> By using the `LoadBalancer` service type, the SQL Server instance is accessible remotely (via the Internet) at port 1433.
@@ -415,7 +403,7 @@ You will create a manifest to describe the container, based on the SQL Server [m
415
403
kubectl.exe exec <nameOfSqlPod> -it -- /bin/bash
416
404
```
417
405
418
-
You are able to see the username as `mssql` if you run `whoami`. `mssql` is a non-root user.
406
+
You can see the username as `mssql` if you run `whoami`. `mssql` is a non-root user.
419
407
420
408
```console
421
409
whoami
@@ -425,7 +413,7 @@ You will create a manifest to describe the container, based on the SQL Server [m
425
413
426
414
The container hosting the SQL Server instance is described as an OpenShift *deployment object*. The deployment creates a *replica set*. The replica set creates the *pod*.
427
415
428
-
You will create a manifest to describe the container, based on the SQL Server [mssql-server-linux](https://hub.docker.com/_/microsoft-mssql-server) Docker image.
416
+
You create a manifest to describe the container, based on the SQL Server [mssql-server-linux](https://hub.docker.com/_/microsoft-mssql-server) Docker image.
429
417
430
418
- The manifest references the `mssql-server` persistent volume claim, and the `mssql` secret that you already applied to the OpenShift cluster.
431
419
- The manifest also describes a [service](https://docs.openshift.com/container-platform/4.12/networking/understanding-networking.html). This service is a load balancer. The load balancer guarantees that the IP address persists after SQL Server instance is recovered.
@@ -451,7 +439,7 @@ You will create a manifest to describe the container, based on the SQL Server [m
451
439
terminationGracePeriodSeconds: 30
452
440
hostname: mssqlinst
453
441
securityContext:
454
-
fsGroup: 10001
442
+
fsGroupChangePolicy: OnRootMismatch
455
443
containers:
456
444
- name: mssql
457
445
image: mcr.microsoft.com/mssql/server:2022-latest
@@ -464,6 +452,10 @@ You will create a manifest to describe the container, based on the SQL Server [m
464
452
cpu: "2000m"
465
453
ports:
466
454
- containerPort: 1433
455
+
securityContext:
456
+
capabilities:
457
+
add:
458
+
- NET_BIND_SERVICE
467
459
env:
468
460
- name: MSSQL_PID
469
461
value: "Developer"
@@ -513,7 +505,7 @@ You will create a manifest to describe the container, based on the SQL Server [m
513
505
514
506
When OpenShift deploys the container, it refers to the secret named `mssql` to get the value for the password.
515
507
516
-
- `securityContext`: Defines privilege and access control settings for a pod or container. In this case it's specified at the pod level, so all containers adhere to that security context. In the security context, we define the `fsGroup` with the value `10001`, which is the Group ID (GID) for the `mssql` group. This value means that all processes of the container are also part of the supplementary GID `10001` (`mssql`). The owner for volume `/var/opt/mssql` and any files created in that volume will be GID `10001` (the `mssql` group).
508
+
- `securityContext`: Defines privilege and access control settings for a pod or container. There are settings applied at both the pod and container level. At the pod level, this option defines the `fsGroupChangePolicy` with the value `OnRootMismatch`. This ensures that the `fsGroup` selected by OpenShift is used for all the files in the `/var/opt/mssql` volume. At the container level, this option permits the `NET_BIND_SERVICE` capability, which allows the container to bind to ports lower than 1024.
517
509
518
510
> [!WARNING]
519
511
> By using the `LoadBalancer` service type, the SQL Server instance is accessible remotely (via the Internet) at port 1433.
0 commit comments