About Me

My photo
I am an MCSE in Data Management and Analytics, specializing in MS SQL Server, and an MCP in Azure. With over 19+ years of experience in the IT industry, I bring expertise in data management, Azure Cloud, Data Center Migration, Infrastructure Architecture planning, as well as Virtualization and automation. I have a deep passion for driving innovation through infrastructure automation, particularly using Terraform for efficient provisioning. If you're looking for guidance on automating your infrastructure or have questions about Azure, SQL Server, or cloud migration, feel free to reach out. I often write to capture my own experiences and insights for future reference, but I hope that sharing these experiences through my blog will help others on their journey as well. Thank you for reading!

 az storage account create \
    --name <your-storage-account-name> \
    --resource-group <your-resource-group-name> \
    --location <location> \
    --sku Standard_LRS

az storage share create \
    --name <your-fileshare-name> \
    --account-name <your-storage-account-name> \
    --account-key $(az storage account keys list --resource-group <your-resource-group-name> --account-name <your-storage-account-name> --query "[0].value" --output tsv)

kubectl create secret generic azure-secret \
    --from-literal=azurestorageaccountname=<your-storage-account-name> \
    --from-literal=azurestorageaccountkey=$(az storage account keys list --resource-group <your-resource-group-name> --account-name <your-storage-account-name> --query "[0].value" --output tsv)

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: azurefile-csi
provisioner: file.csi.azure.com
parameters:
  skuName: Standard_LRS
  secretName: azure-secret           # Reference to the secret created
  secretNamespace: default           # Namespace where the secret is created
  shareName: <your-fileshare-name>   # Specify the file share name explicitly
mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - uid=1000
  - gid=1000
reclaimPolicy: Retain
volumeBindingMode: Immediate
allowVolumeExpansion: true

---

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mssql-statefulset
spec:
  serviceName: "mssql-service"
  replicas: 1
  selector:
    matchLabels:
      app: mssql
  template:
    metadata:
      labels:
        app: mssql
    spec:
      containers:
      - name: mssql
        # Linux-based MSSQL Server image
        image: mcr.microsoft.com/mssql/server:2019-latest
        ports:
        - containerPort: 1433
          name: mssql
        env:
        - name: ACCEPT_EULA
          value: "Y"
        - name: SA_PASSWORD
          value: "password@123"  # Replace with your own strong password
        volumeMounts:
        - name: mssql-data
          mountPath: /var/opt/mssql
      tolerations:
      - key: "kubernetes.azure.com/scalesetpriority"
        operator: "Equal"
        value: "spot"
        effect: "NoSchedule"
  volumeClaimTemplates:
  - metadata:
      name: mssql-data
    spec:
      accessModes: ["ReadWriteMany"]
      storageClassName: "azurefile-csi"
      resources:
        requests:
          storage: 20Gi


No comments: