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

Prerequisites

Connecting to Kubernetes Cluster

  1. These commands will not work in cloud shell and must be running on your local machine.
  2. If you are planning to access the Kubernetes cluster using Public IP then copy Internet Access Code.
  3. If you have a VPN setup for this cluster then you can use VPN Access
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

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

TryHackMe — CC: Steganography

Oversimplified — Bug Bounty

What Unit Testing Tells You About Your Code

Noob’s Guide to building a Deep Learning / Cryptocurrency PC (#2): The OS

Dynamic DNS using Alibaba Cloud DNS API

Tecra team members. Sabrina Bilmak, Back-End developer

.NET 5 API Authorization Integration Tests

Ionic 5 Tutorials Series | Part-3 Ionic UI Components

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
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

LEARN TO DEPLOY POSTGRES HA ON KUBERNETES IN 60 MINUTES

5 Kubernetes Alternative to check out in 2022

Setup Jenkins in Docker container

Docker and Kubernetes essentials