How to Deploy a SQL Server Container in Alibaba Container Service Kubernetes

Prerequisites

Connecting to Kubernetes Cluster

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install kubernetes-cli
kubectl version
echo $HOMEcd C:\mkdir C:\Kubelet\ .kubecd C:\Kubelet\ .kubeNew-Item config -type file
kubectl cluster-info

Deploy a SQL Server Using Kubernetes Web UI Management Interface

kubectl create secret generic mssql --from-literal=SA_PASSWORD="Pass@123db"
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: mssql-data
spec:
storageClassName: alicloud-disk-ssd #Change the Storage Class value
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 30Gi
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: mssql-deployment
spec:
replicas: 1
template:
metadata:
labels:
app: mssql
spec:
terminationGracePeriodSeconds: 10
containers:
- name: mssql
image: microsoft/mssql-server-linux
ports:
- containerPort: 1433
env:
- name: ACCEPT_EULA
value: "Y"
- name: SA_PASSWORD
valueFrom:
secretKeyRef:
name: mssql
key: SA_PASSWORD
volumeMounts:
- name: mssql-data
mountPath: /var/opt/mssql
volumes:
- name: mssql-data
persistentVolumeClaim:
claimName: mssql-data
---
apiVersion: v1
kind: Service
metadata:
name: mssql-deployment
spec:
selector:
app: mssql
ports:
- protocol: TCP
port: 1433
targetPort: 1433
type: LoadBalancer

References:

Original Source

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store