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: articles/azure-arc/data/create-sql-managed-instance-using-kubernetes-native-tools.md
+47-75Lines changed: 47 additions & 75 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,97 +1,56 @@
1
1
---
2
-
title: Create a SQL managed instance using Kubernetes tools
3
-
description: Create a SQL managed instance using Kubernetes tools
2
+
title: Create a SQL Managed Instance using Kubernetes tools
3
+
description: Deploy Azure Arc-enabled SQL Managed Instance using Kubernetes tools.
4
4
services: azure-arc
5
5
ms.service: azure-arc
6
6
ms.subservice: azure-arc-data
7
7
author: dnethi
8
8
ms.author: dinethi
9
9
ms.reviewer: mikeray
10
-
ms.date: 07/30/2021
10
+
ms.date: 02/28/2022
11
11
ms.topic: how-to
12
12
---
13
13
14
-
# Create Azure SQL managed instance using Kubernetes tools
14
+
# Create Azure Arc-enabled SQL Managed Instance using Kubernetes tools
15
15
16
+
This article demonstrates how to deploy Azure SQL Managed Instance for Azure Arc with Kubernetes tools.
16
17
17
18
## Prerequisites
18
19
19
20
You should have already created a [data controller](plan-azure-arc-data-services.md).
20
21
21
-
To create a SQL managed instance using Kubernetes tools, you will need to have the Kubernetes tools installed. The examples in this article will use `kubectl`, but similar approaches could be used with other Kubernetes tools such as the Kubernetes dashboard, `oc`, or `helm` if you are familiar with those tools and Kubernetes yaml/json.
22
+
To create a SQL managed instance using Kubernetes tools, you will need to have the Kubernetes tools installed. The examples in this article will use `kubectl`, but similar approaches could be used with other Kubernetes tools such as the Kubernetes dashboard, `oc`, or `helm` if you are familiar with those tools and Kubernetes yaml/json.
22
23
23
24
[Install the kubectl tool](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
24
25
25
26
## Overview
26
27
27
-
To create a SQL managed instance, you need to create a Kubernetes secret to store your system administrator login and password securely and a SQL managed instance custom resource based on the SqlManagedInstance custom resource definition.
28
+
To create a SQL Managed Instance, you need to:
29
+
1. Create a Kubernetes secret to store your system administrator login and password securely
30
+
1. Create a SQL Managed Instance custom resource based on the `SqlManagedInstance` custom resource definition
31
+
32
+
Define both of these items in a yaml file.
28
33
29
34
## Create a yaml file
30
35
31
-
You can use the [template yaml](https://raw.githubusercontent.com/microsoft/azure_arc/main/arc_data_services/deploy/yaml/sqlmi.yaml) file as a starting point to create your own custom SQL managed instance yaml file. Download this file to your local computer and open it in a text editor. It is useful to use a text editor such as [VS Code](https://code.visualstudio.com/download) that support syntax highlighting and linting for yaml files.
36
+
Use the [template yaml](https://raw.githubusercontent.com/microsoft/azure_arc/main/arc_data_services/deploy/yaml/sqlmi.yaml) file as a starting point to create your own custom SQL managed instance yaml file. Download this file to your local computer and open it in a text editor. Use a text editor such as [VS Code](https://code.visualstudio.com/download) that support syntax highlighting and linting for yaml files.
32
37
33
-
This is an example yaml file:
38
+
> [!NOTE]
39
+
> Beginning with the February, 2022 release, `ReadWriteMany` (RWX) capable storage class needs to be specified for backups. Learn more about [access modes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes).
40
+
> If no storage class is specified for backups, the default storage class in Kubernetes is used. If the default is not RWX capable, the SQL Managed Instance installation may not succeed.
34
41
35
-
```yaml
36
-
apiVersion: v1
37
-
data:
38
-
password: <your base64 encoded password>
39
-
username: <your base64 encoded username>
40
-
kind: Secret
41
-
metadata:
42
-
name: sql1-login-secret
43
-
type: Opaque
44
-
---
45
-
apiVersion: sql.arcdata.microsoft.com/v1
46
-
kind: SqlManagedInstance
47
-
metadata:
48
-
name: sql1
49
-
annotations:
50
-
exampleannotation1: exampleannotationvalue1
51
-
exampleannotation2: exampleannotationvalue2
52
-
labels:
53
-
examplelabel1: examplelabelvalue1
54
-
examplelabel2: examplelabelvalue2
55
-
spec:
56
-
security:
57
-
adminLoginSecret: sql1-login-secret
58
-
scheduling:
59
-
default:
60
-
resources:
61
-
limits:
62
-
cpu: "2"
63
-
memory: 4Gi
64
-
requests:
65
-
cpu: "1"
66
-
memory: 2Gi
67
-
services:
68
-
primary:
69
-
type: LoadBalancer
70
-
storage:
71
-
backups:
72
-
volumes:
73
-
- className: default # Use default configured storage class or modify storage class based on your Kubernetes environment
74
-
size: 5Gi
75
-
data:
76
-
volumes:
77
-
- className: default # Use default configured storage class or modify storage class based on your Kubernetes environment
78
-
size: 5Gi
79
-
datalogs:
80
-
volumes:
81
-
- className: default # Use default configured storage class or modify storage class based on your Kubernetes environment
82
-
size: 5Gi
83
-
logs:
84
-
volumes:
85
-
- className: default # Use default configured storage class or modify storage class based on your Kubernetes environment
A Kubernetes secret is stored as a base64 encoded string - one for the username and one for the password. You will need to base64 encode a system administrator login and password and place them in the placeholder location at `data.password` and `data.username`. Do not include the `<` and `>` symbols provided in the template.
50
+
A Kubernetes secret is stored as a base64 encoded string - one for the username and one for the password. You will need to base64 encode a system administrator login and password and place them in the placeholder location at `data.password` and `data.username`. Do not include the `<` and `>` symbols provided in the template.
92
51
93
52
> [!NOTE]
94
-
> For optimum security, using the value 'sa' is not allowed for the login .
53
+
> For optimum security, using the value `sa` is not allowed for the login .
95
54
> Follow the [password complexity policy](/sql/relational-databases/security/password-policy#password-complexity).
96
55
97
56
You can use an online tool to base64 encode your desired username and password or you can use built in CLI tools depending on your platform.
The template has a value of 'sql1' for the name attribute. You can change this but it must be characters that follow the DNS naming standards. You must also change the name of the secret to match. For example, if you change the name of the SQL managed instance to 'sql2', you must change the name of the secret from 'sql1-login-secret' to 'sql2-login-secret'
78
+
The template has a value of `sql1` for the name attribute. You can change this value, but it must include characters that follow the DNS naming standards. You must also change the name of the secret to match. For example, if you change the name of the SQL managed instance to `sql2`, you must change the name of the secret from `sql1-login-secret` to `sql2-login-secret`
120
79
121
80
### Customizing the resource requirements
122
81
123
-
You can change the resource requirements - the RAM and core limits and requests - as needed.
82
+
You can change the resource requirements - the RAM and core limits and requests - as needed.
124
83
125
84
> [!NOTE]
126
85
> You can learn more about [Kubernetes resource governance](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-units-in-kubernetes).
@@ -129,18 +88,31 @@ Requirements for resource limits and requests:
129
88
- The cores limit value is **required** for billing purposes.
130
89
- The rest of the resource requests and limits are optional.
131
90
- The cores limit and request must be a positive integer value, if specified.
132
-
- The minimum of 1 cores is required for the cores request, if specified.
133
-
- The memory value format follows the Kubernetes notation.
134
-
- A minimum of 2Gi is required for memory request, if specified.
135
-
- As a general guideline, you should have 4GB of RAM for each 1 core for production use cases.
91
+
- The minimum of 1 core is required for the cores request, if specified.
92
+
- The memory value format follows the Kubernetes notation.
93
+
- A minimum of 2 Gi is required for memory request, if specified.
94
+
- As a general guideline, you should have 4 GB of RAM for each 1 core for production use cases.
136
95
137
96
### Customizing service type
138
97
139
-
The service type can be changed to NodePort if desired. A random port number will be assigned.
98
+
The service type can be changed to NodePort if desired. A random port number will be assigned.
140
99
141
100
### Customizing storage
142
101
143
-
You can customize the storage classes for storage to match your environment. If you are not sure which storage classes are available you can run the command `kubectl get storageclass` to view them. The template has a default value of 'default'. This means that there is a storage class _named_ 'default' not that there is a storage class that _is_ the default. You can also optionally change the size of your storage. You can read more about [storage configuration](./storage-configuration.md).
102
+
You can customize the storage classes for storage to match your environment. If you are not sure which storage classes are available, run the command `kubectl get storageclass` to view them.
103
+
104
+
The template has a default value of `default`.
105
+
106
+
For example
107
+
108
+
```yml
109
+
storage:
110
+
data:
111
+
volumes:
112
+
- className: default
113
+
```
114
+
115
+
This example means that there is a storage class named `default` - not that there is a storage class that is the default. You can also optionally change the size of your storage. For more information, see [storage configuration](./storage-configuration.md).
144
116
145
117
## Creating the SQL managed instance
146
118
@@ -158,7 +130,7 @@ kubectl create -n <your target namespace> -f <path to your yaml file>
158
130
Creating the SQL managed instance will take a few minutes to complete. You can monitor the progress in another terminal window with the following commands:
159
131
160
132
> [!NOTE]
161
-
> The example commands below assume that you created a SQL managed instance named 'sql1' and Kubernetes namespace with the name 'arc'. If you used a different namespace/SQL managed instance name, you can replace 'arc' and 'sqlmi' with your names.
133
+
> The example commands below assume that you created a SQL managed instance named `sql1` and Kubernetes namespace with the name `arc`. If you used a different namespace/SQL managed instance name, you can replace `arc` and `sqlmi` with your names.
162
134
163
135
```console
164
136
kubectl get sqlmi/sql1 --namespace arc
@@ -168,7 +140,7 @@ kubectl get sqlmi/sql1 --namespace arc
168
140
kubectl get pods --namespace arc
169
141
```
170
142
171
-
You can also check on the creation status of any particular pod by running a command like below. This is especially useful for troubleshooting any issues.
143
+
You can also check on the creation status of any particular pod. Run `kubectl describe pod ...`. Use this command to troubleshoot any issues. For example:
0 commit comments