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
+44-77Lines changed: 44 additions & 77 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,102 +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
38
> [!NOTE]
34
-
>Note: Starting with the Februaryrelease, a 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)
35
-
If no storage class is specified for backups, the default storage class in kubernetes is used and if this is not RWX capable, the Arc SQL Managed Instance installation may not succeed.
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.
36
41
42
+
### Example yaml file
37
43
38
-
This is an example yaml file:
44
+
See the following example of a yaml file:
39
45
40
-
```yaml
41
-
apiVersion: v1
42
-
data:
43
-
password: <your base64 encoded password>
44
-
username: <your base64 encoded username>
45
-
kind: Secret
46
-
metadata:
47
-
name: sql1-login-secret
48
-
type: Opaque
49
-
---
50
-
apiVersion: sql.arcdata.microsoft.com/v1
51
-
kind: SqlManagedInstance
52
-
metadata:
53
-
name: sql1
54
-
annotations:
55
-
exampleannotation1: exampleannotationvalue1
56
-
exampleannotation2: exampleannotationvalue2
57
-
labels:
58
-
examplelabel1: examplelabelvalue1
59
-
examplelabel2: examplelabelvalue2
60
-
spec:
61
-
security:
62
-
adminLoginSecret: sql1-login-secret
63
-
scheduling:
64
-
default:
65
-
resources:
66
-
limits:
67
-
cpu: "2"
68
-
memory: 4Gi
69
-
requests:
70
-
cpu: "1"
71
-
memory: 2Gi
72
-
services:
73
-
primary:
74
-
type: LoadBalancer
75
-
storage:
76
-
backups:
77
-
volumes:
78
-
- className: default # Use default configured storage class or modify storage class based on your Kubernetes environment
79
-
size: 5Gi
80
-
data:
81
-
volumes:
82
-
- className: default # Use default configured storage class or modify storage class based on your Kubernetes environment
83
-
size: 5Gi
84
-
datalogs:
85
-
volumes:
86
-
- className: default # Use default configured storage class or modify storage class based on your Kubernetes environment
87
-
size: 5Gi
88
-
logs:
89
-
volumes:
90
-
- 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.
97
51
98
52
> [!NOTE]
99
-
> 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 .
100
54
> Follow the [password complexity policy](/sql/relational-databases/security/password-policy#password-complexity).
101
55
102
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`
125
79
126
80
### Customizing the resource requirements
127
81
128
-
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.
129
83
130
84
> [!NOTE]
131
85
> You can learn more about [Kubernetes resource governance](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-units-in-kubernetes).
@@ -134,18 +88,31 @@ Requirements for resource limits and requests:
134
88
- The cores limit value is **required** for billing purposes.
135
89
- The rest of the resource requests and limits are optional.
136
90
- The cores limit and request must be a positive integer value, if specified.
137
-
- The minimum of 1 cores is required for the cores request, if specified.
138
-
- The memory value format follows the Kubernetes notation.
139
-
- A minimum of 2Gi is required for memory request, if specified.
140
-
- 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.
141
95
142
96
### Customizing service type
143
97
144
-
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.
145
99
146
100
### Customizing storage
147
101
148
-
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).
149
116
150
117
## Creating the SQL managed instance
151
118
@@ -163,7 +130,7 @@ kubectl create -n <your target namespace> -f <path to your yaml file>
163
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:
164
131
165
132
> [!NOTE]
166
-
> 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.
167
134
168
135
```console
169
136
kubectl get sqlmi/sql1 --namespace arc
@@ -173,7 +140,7 @@ kubectl get sqlmi/sql1 --namespace arc
173
140
kubectl get pods --namespace arc
174
141
```
175
142
176
-
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