2

I have followed Barts’ excellent tutorial to get a development instance of Sitecore 10.2 up and running on AKS.

https://github.com/bplasmeijer/Sitecore-Symposium-2020-Containers-AKS

There is one flaw though, when the windows AKS node gets restarted (patching etc) the SQL database gets wiped entirely. Sure, a dev environment should be ephemeral, but I want the DB to persist beyond a machine restart. I was looking to add persistence with a volume mount for the data folder from below image, is that possible? If so what is the folder mount path?

image: scr.sitecore.com/sxp/nonproduction/mssql-developer:2017-10.0-ltsc2019

The alternative is to use the below Microsoft image on a Linux node (Microsoft don’t support a Windows SQL Image), or PaaS Azure SQL – I am shying away from those from a cost perspective for a dev instance, although the linux node is probably palatable.

image: mcr.microsoft.com/mssql/server:2019-latest

1 Answer 1

1

I think a Persistent Volume Claim might be what you are looking for. This effectively creates a storage account in your azure subscription and saves the data from the SQL to it.

Try something like this:

Create new storage class using azure-file-sc.yaml

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: sitecore-azurefile
provisioner: file.csi.azure.com
allowVolumeExpansion: true
mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - uid=0
  - gid=0
  - mfsymlinks
  - cache=strict
  - actimeo=30
parameters:
  skuName: Premium_LRS

Create new persistent volume claim using azure-file-pvc.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sitecore-pvc
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: sitecore-azurefile
  resources:
    requests:
      storage: 100Gi

Update Barts SQL deployment to something like below:

apiVersion: v1
kind: Service
metadata:
  name: mssql
spec:
  selector:
    app: mssql
  ports:
  - protocol: TCP
    port: 1433
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mssql
  labels:
    app: mssql
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mssql
  template:
    metadata:
      labels:
        app: mssql
    spec:
      nodeSelector:
        kubernetes.io/os: windows
      containers:
      - name: mssql
        image: scr.sitecore.com/sxp/nonproduction/mssql-developer:2017-10.0.0-ltsc2019
        ports:
        - containerPort: 1433
        env:
        - name: SA_PASSWORD
          valueFrom:
            secretKeyRef:
              name: sitecore-database
              key: sitecore-databasepassword.txt
        - name: ACCEPT_EULA
          value: "Y"
        volumeMounts:
        - mountPath: "/mnt/azure"
        name: sitecore-persistent-volume
      volumes:
        - name: sitecore-persistent-volume
        persistentVolumeClaim:
          claimName: sitecore-pvc
      imagePullSecrets:
      - name: sitecore-docker-registry

Note: I havent tested this out, but it should hopefully point you in the correct direction if not quite correct.

Reference: https://learn.microsoft.com/en-us/azure/aks/azure-files-dynamic-pv

5
  • Thanks @Dean - I did get that far, what blocked me is what is the mount path? I couldn't find an answer to that?
    – BikerP
    Commented Nov 12, 2022 at 9:53
  • 1
    That should be the location within the container that the sql data is stored. I think it should be C:\data for a windows image, depends on the exact image being used. If that doesnt work, then try connecting to the SQL image using SSMS and locate what directory the MDF and LDF files are mounted to. That should be the path used as the mount. Commented Nov 12, 2022 at 18:11
  • Good shout, thanks
    – BikerP
    Commented Nov 15, 2022 at 7:53
  • I noticed the community bot revived this thread... did you get it sorted in the end? Commented Dec 11, 2022 at 15:31
  • I abandoned this approach and went with PaaS SQL in the end, i assume your suggestion will work, but i have not verified it.
    – BikerP
    Commented Dec 13, 2022 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.