Skip to content

Commit a8b4dea

Browse files
committed
Add readme for rancher helm chart
1 parent 7f26fc3 commit a8b4dea

File tree

2 files changed

+41
-135
lines changed

2 files changed

+41
-135
lines changed

linux/rancher/readme.md

Lines changed: 38 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,40 @@
1-
# Readme.md
2-
3-
This HELM chart is a sample "as-is" chart provided for reference to help guide with SQL Server deployment on Kubernetes cluster.
1+
# SQL Server Chart for Rancher
2+
This helm chart provided for reference to help guide with SQL Server deployments on SUSE Rancher with no warranties or support. While it will be geared towards using on Rancher it's simply a helm chart so can be used in any helm deployments.
43

54
## Prerequisites:
6-
7-
1. This chart is built on helm v3. It requires a kubernetes cluster to be running for you to deploy SQL container using this chart.
8-
2. Ensure you have the helm installed on the client from where you will connect to the kubernetes cluster to deploy using the helm chart.
9-
3. For minimum hardware requirement for the host to run SQL Server containers please refer to the system requirements section for SQL on Linux.
10-
4. Requires the following variables to be set or changed in the values.yaml file :<br/>
11-
a. Please ensure that you accept the EULA for SQL Server, by changing the value of ACCEPT_EULA.value=y in values.yaml file or set it during the helm install command --set ACCEPT_EULA.value=Y.<br/>
12-
b. Please do choose the right edition of SQL Server that you would like to install you can change the value of the MSSQL_PID.value in the values file to the edition that you want to install or you can also
13-
change it during the helm install command using the option --set MSSQL_PID.value=Enterprise, If you do not pass the flag and do not change it in the yaml, then by default it is going to install developer edition.<br/> c. Also please do provide your customized value for the sa_password, if you do not provide it then by default the sa_password will the value as shown in the below table.<br/>
14-
15-
Note: Once you deploy SQL server containers using the chart below, please log into SQL Server using sa account and change the password for sa, this ensures that as DBA you have the control of the sa user and password.
16-
17-
18-
## Chart usage:
19-
20-
On the client machine where you have the Helm tools installed, download the chart on your machine and make the required changes to the values.yaml file as per your requirement. To see the list of settings that can be changed using the values.yaml file please refer to the table below.
21-
22-
23-
24-
| Configuration parameters | Description | Default_Value |
25-
|----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------- |
26-
| Values.image.repository | The SQL image to be downloaded and used for container deployment. | mcr.microsoft&#46;com/mssql/server |
27-
| Values.image.tag | The tag of the image to be download for the specific SQL image. | 2019-latest |
28-
| Values.ACCEPT_EULA.value | Set the ACCEPT_EULA variable to any value to confirm your acceptance of the SQL Server EULA, please refer environment variable for more details. | Y |
29-
| Values.MSSQL_PID.value | Set the SQL Server edition or product key. please refer environment variable for more details | Developer |
30-
| Values.MSSQL_AGENT_ENABLED.value | Enable SQL Server Agent. For example, 'true' is enabled and 'false' is disabled. By default, agent is disabled. please refer environment variable for more details. | TRUE |
31-
| Values.containers.ports.containerPort | Port on which the SQL Server is listening inside the container. | 1433 |
32-
| Values.podSecurityContext.fsgroup | Security context at the pod level. | 10001 |
33-
| Values.service.port | The service port number. | 1433 |
34-
| Values.replicas | This value controls the number of SQL Server deployments that would be done, consider this as the number of SQL Server instances that will run. | 3 |
35-
36-
<br/>
37-
38-
## Deployment details:
39-
40-
> [!NOTE]
41-
> Here are my deployment details, please make changes to the values.yaml or other files as per your requirement.
42-
43-
<br/>
44-
45-
In this scenario, I am deploying three SQL Server containers on a Azure Kubernetes Service (AKS) as statefulset deployments. You can follow [Setup and connect to AKS](https://docs.microsoft.com/en-us/azure/aks/kubernetes-walkthrough-portal) to read instructions on setting up AKS and connecting to it. Also the storage class that I am using here is "Azure-disk". Please do find details below for each of the yaml file used in the template folder of this chart.
46-
47-
| File Name | Description |
48-
|-|-|
49-
| _helpers.tpl | Template file with all the template definitions that will be used in this chart. |
50-
| deployment.yaml | A manifest file to describing the deployment details for SQL Server. |
51-
| mssqlconfig.yaml | SQL server mssql.conf file and its content that you would like to mount to the SQL Server container. For parameters that you can pass in this file please refer mssql.conf documentation. To modify the mssql.conf settings please modify this file. |
52-
| sc.yaml | A manifest file that describes the storage class (SC) to be deployed. To make any changes to the sc please modify this file accordingly. |
53-
| service.yaml | A manifest file that defines the kubernetes service type and port. Because this is a statefulset deployment, this manifest files helps in creating the headless service. Please modify this for any service modification that is needed. |
54-
55-
<br/>
56-
57-
With this information, and probably after you have modified the required files you are now ready to deploy SQL Server using this chart. From the client machine where you have the helm chart installed, change the
58-
directory of the CLI to the directory where you have the chart downloaded and to deploy SQL Server using this chart run the command:
59-
<br/>
60-
61-
62-
``` bash
63-
helm install mssql . --set ACCEPT_EULA.value=Y --set MSSQL_PID.value=Developer
64-
```
65-
<br/>
66-
67-
After a few minutes this should deploy the SQL Server containers and you can see all the artifacts using the command :
68-
<br/>
69-
70-
```bash
71-
D:\helm-charts\sql-server-rancher>kubectl get all
72-
```
73-
74-
The output should look as shown below:
75-
76-
<br/>
77-
78-
```bash
79-
NAME READY STATUS RESTARTS AGE
80-
pod/mssql-sql-server-rancher-0 1/1 Running 0 12m
81-
pod/mssql-sql-server-rancher-1 1/1 Running 0 12m
82-
pod/mssql-sql-server-rancher-2 1/1 Running 0 12m
83-
84-
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
85-
service/mssql-sql-server-rancher ClusterIP None <none> 1433/TCP 16m
86-
87-
NAME READY AGE
88-
statefulset.apps/mssql-sql-server-rancher 3/3 16m
89-
```
90-
91-
This chart also includes an extra folder called "services" this folder has two more manifest files as described below:
92-
93-
| Name | Description |
94-
|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
95-
| ex_service.yaml | This containes sample code to create the external load balancer service for each of the pods created above, so SQL Server can be accessed outside the cluster |
96-
| ag_endpoint.yaml | This containes sample code to expose the AG endpoint ports within the cluster, so each pod can talk to one another on the AG port. This will be needed if you are setting up AG between the pods. |
97-
98-
<br/>
99-
100-
Once you deploy the above files as well, using the commands shown below, you should have an external load balancer service created for each of the pods and another cluster IP service for each of the pod exposing the AG (alwayson) port for each pod within the cluster.
101-
102-
103-
```bash
104-
D:\helm-charts\sql-server-rancher>kubectl apply -f "D:\helm-charts\sql-server-rancher\services\ex_service.yaml"
105-
D:\helm-charts\sql-server-rancher>kubectl apply -f "D:\helm-charts\sql-server-rancher\services\ag_endpoint.yaml"
106-
```
107-
108-
109-
Finally, after all the deployments here are the resources that you should see:
110-
111-
112-
```bash
113-
D:\>kubectl get all
114-
NAME READY STATUS RESTARTS AGE
115-
pod/mssql-sql-server-rancher-0 1/1 Running 0 127m
116-
pod/mssql-sql-server-rancher-1 1/1 Running 0 126m
117-
pod/mssql-sql-server-rancher-2 1/1 Running 0 125m
118-
119-
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
120-
service/kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 220d
121-
service/mssql-mirror-0 ClusterIP 10.0.148.0 <none> 5022/TCP 124m
122-
service/mssql-mirror-1 ClusterIP 10.0.254.58 <none> 5022/TCP 124m
123-
service/mssql-mirror-2 ClusterIP 10.0.196.129 <none> 5022/TCP 124m
124-
service/mssql-sql-server-rancher ClusterIP None <none> 1433/TCP 127m
125-
service/mssql-sql-server-rancher-0 LoadBalancer 10.0.238.203 104.211.231.206 1433:30923/TCP 124m
126-
service/mssql-sql-server-rancher-1 LoadBalancer 10.0.96.108 104.211.203.78 1433:32695/TCP 124m
127-
service/mssql-sql-server-rancher-2 LoadBalancer 10.0.78.10 104.211.203.159 1433:31042/TCP 124m
128-
129-
NAME READY AGE
130-
statefulset.apps/mssql-sql-server-rancher 3/3 127m
131-
```
132-
133-
## Connect to SQL Server
134-
135-
Now you are ready to connect to the SQL Server using any of the familiar tools that you work with, like the [SSMS](https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15) (SQL Server Management Studio) or [SQLCMD](https://docs.microsoft.com/en-us/sql/tools/sqlcmd-utility?view=sql-server-ver15) or [ADS](https://docs.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio?view=sql-server-ver15) (Azure Data Studio), etc. The IP address that you will use to connect is the External-IP address for the pod service which in this case one such example is: to connect to mssql-sql-server-rancher-0 SQL Server, the IP address 104.211.231.206 will be used in ssms or any other client.
136-
137-
For more details on the SQL Server deployment on AKS using manual method please refer [Deploy a SQL Server container in Kubernetes with Azure Kubernetes Services (AKS)](https://docs.microsoft.com/en-us/sql/linux/tutorial-sql-server-containers-kubernetes?view=sql-server-ver15).
5+
1. Kubernetes 1.19+ cluster
6+
1. [Helm >= 3.2 client](https://helm.sh/docs/intro/install) installed on the machine where you will deploy from
7+
1. Connectivity to the Kubenetes cluster api endpoint from your machine
8+
1. [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/) for the cluster you will deploy to with `cluster-admin` permissions.
9+
10+
## Chart Usage
11+
12+
### SQL Server EULA
13+
NOTE: By deploying this Chart you are agreeing to the [SQL Server EULA](http://go.microsoft.com/fwlink/?LinkId=746388)
14+
15+
### Quickstart
16+
1. Clone this repo.
17+
1. Change to the repo directory
18+
- `cd linux/rancher`
19+
1. Change the `sa` password in [values.example.yaml](./values.example.yaml)
20+
1. Deploy the chart with:
21+
- `helm install --create-namespace -n sql-server -f values.example.yaml .`
22+
23+
### Defaults:
24+
For chart defaults take a look at [values.yaml](./values.yaml). Some notable ones are:
25+
- `mssql.pid` to change the SQL Server edition
26+
- `statefulset.template.spec.containers.sqlServer.image` to change the deployed image
27+
28+
### StorageClasses
29+
By default the chart uses the default storage class of the cluster. You can configure a
30+
CSI storage class for AKS/GKE/EKS. Please see [values.test.yaml](./values.test.yaml) for an example.
31+
Further details are in [storageclass.yaml](./templates/storageclass.yaml)
32+
33+
34+
## Contributing
35+
Contributions are welcome. Please open a pull request. Remember to:
36+
- bump the version in [Chart.yaml](./Chart.yaml#18) accordingly
37+
- add any defaults to [values.yaml](./values.yaml)
38+
- add variables to be tested in [values.test.yaml](./values.test.yaml)
39+
- ensure the lint passes with `make lint`
40+
- test your changes on a deployment

linux/rancher/values.example.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mssql:
2+
sa:
3+
password: Sfr9nxVVkbMVGTQweKmD

0 commit comments

Comments
 (0)