Home > Workload Solutions > SQL Server > White Papers > Dell EMC PowerMax Storage for Mission-Critical SQL Server Databases > Deployment of SQL Server
Once the required PVCs are in place, you are ready to deploy SQL Server. All created PVCs will be mounted to their respective directories in the SQL container. In this document example, 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.
Create a manifest to describe the container based on the SQL Server mssql-server-linux Docker image. The manifest references the mssql-server persistent volume claim, and the mssql secret that is already applied to the Kubernetes cluster. The manifest also describes a service, which is a load balancer. The load balancer guarantees that the IP address persists after the SQL Server instance is recovered.
kind: Deployment
metadata:
name: mssql-deployment-1
namespace: mssql
spec:
replicas: 1
template:
metadata:
labels:
app: mssql
spec:
terminationGracePeriodSeconds: 10
containers:
- name: mssql
image: mcr.microsoft.com/mssql/server:2017-latest
ports:
- containerPort: 1433
env:
- name: MSSQL_PID
value: "Developer"
- name: ACCEPT_EULA
value: "Y"
- name: MSSQL_SA_PASSWORD
valueFrom:
secretKeyRef:
name: mssql
key: SA_PASSWORD
volumeMounts:
- name: mssqlsvr
mountPath: /var/opt/mssql
- name: mssqldata
mountPath: /mssql/data
- name: mssqllog
mountPath: /mssql/log
- name: mssqlbackup
mountPath: /mssql/backup
volumes:
- name: mssqlsvr
persistentVolumeClaim:
claimName: mssql-server-1
- name: mssqldata
persistentVolumeClaim:
claimName: mssql-data-1
- name: mssqllog
persistentVolumeClaim:
claimName: mssql-log-1
- name: mssqlbackup
persistentVolumeClaim:
claimName: mssql-backup
---
apiVersion: v1
kind: Service
metadata:
name: mssql-deployment-1
namespace: mssql
spec:
selector:
app: mssql
ports:
- protocol: TCP
port: 1433
targetPort: 1433
externalIPs:
- 10.228.247.248
Some of the fields and their values in the manifest are explained here:
Create deployment using manifest file using the kubectl create -f <manifest file name> command:
# kubectl create -f deploy-mssql-server-1.yaml
deployment.apps/mssql-deployment-1 created
The deployment and service are created. The SQL Server instance is in a container, connected to persistent storage. To view the status of the pod, enter the kubectl get pod command.
# kubectl get pod -n mssql
NAME READY STATUS RESTARTS AGE
mssql-deployment-1-7f754f6d7b-jss58 1/1 Running 0 75s
If the pod has a status of Running, it indicates that the container is ready. It may take several minutes for the pod to get to the Running state after being deployed.
# kubectl describe pod mssql-deployment-1-7f754f6d7b-jss58
Name: mssql-deployment-1-7f754f6d7b-jss58
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: dsib3244/10.228.247.244
Start Time: Thu, 01 Aug 2019 19:31:41 -0400
Labels: app=mssql
pod-template-hash=7f754f6d7b
Annotations: <none>
Status: Running
IP: 10.233.65.72
Controlled By: ReplicaSet/mssql-deployment-1-7f754f6d7b
Containers:
mssql:
Container ID: docker://439a0bb16317ccd42af75e38b10e0b479b3968025a77f1c8325c38e7fae192e5
Image: mcr.microsoft.com/mssql/server:2017-latest
Image ID: docker-pullable://mcr.microsoft.com/mssql/server@sha256:29fb9c64b0efb56948864b4df9e8b1dc26ef3ecc552e64902c24d81519f6a15e
Port: 1433/TCP
Host Port: 0/TCP
State: Running
Started: Thu, 01 Aug 2019 19:32:19 -0400
Ready: True
The kubectl get services command returns services that are running, as well as the internal and external IP addresses for the services. Make note of the external IP address for the mssql-deployment service. Use this IP address to connect to SQL Server.
# kubectl get services -n mssql
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
mssql-deployment-8 ClusterIP 10.233.45.10 10.228.247.248 1433/TCP 2d
A static route may be required to be configured on the host accessing SQL Server. If required, set a static route for EXTERNAL-IP of the service with gateway as one of the nodes of the cluster.