0

I want to attach a shared disk to multiple windows containers on AKS. From post learned that it can be done for Linux containers.

I am trying to do the same with windows container but it's failing to mount a shared disk, with below error

MapVolume.MapPodDevice failed for volume "pvc-6e07bdca-2126-4a5b-806a-026016c3798d" : rpc error: code = Internal desc = Could not mount "2" at "\var\lib\kubelet\plugins\kubernetes.io\csi\volumeDevices\publish\pvc-6e07bdca-2126-4a5b-806a-026016c3798d\4e44da87-ea33-4d85-a7db-076db0883bcf": rpc error: code = Unknown desc = not an absolute Windows path: 2 Error occured

Used below to dynamically provision Shared Azure Disk

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: managed-csi-custom
provisioner: disk.csi.azure.com
parameters:
  skuname: Premium_LRS  
  maxShares: "2"
  cachingMode: None
reclaimPolicy: Delete
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-azuredisk-dynamic
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 4Gi  
  volumeMode: Block
  storageClassName: managed-csi-custom
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: test-shared-disk
  name: deployment-azuredisk
spec:
  replicas: 2
  selector:
    matchLabels:
      app: test-shared-disk
  template:
    metadata:
      labels:
        app: test-shared-disk
      name: deployment-azuredisk
    spec:
      nodeSelector:
        role: windowsgeneral
      containers:
        - name: deployment-azuredisk
          image: mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019
          volumeDevices:
            - name: azuredisk
              devicePath: "D:\test"
      volumes:
        - name: azuredisk
          persistentVolumeClaim:
            claimName: pvc-azuredisk-dynamic

Is it possible to mount shared disk for windows container on AKS? Thanks for help.

  • Can you please use the device path as like did in thread you shared **devicePath: /dev/sdx** or another location in C drive. – RahulKumarShaw Feb 17 '22 at 05:35
  • @RahulKumarShaw-MT: Yes tried, faced the same issue. – Suraj Punugade Feb 21 '22 at 13:18
  • Mouting while provisioning the windows pods is not possible, So in onder to overcome this you have to deploye the pods first and then followed this [Document](https://learn.microsoft.com/en-us/azure/aks/azure-disk-csi#windows-containers) for the share disk using the CSI driver – RahulKumarShaw Feb 21 '22 at 14:13
  • Did you ever figure this out? Having the exact error trying to mount a managed disk to a windows cluster. Thanks! – Ryan Peters Sep 16 '22 at 22:15

1 Answers1

0

Azure shared disks is an Azure managed disks feature that enables attaching an Azure disk to agent nodes simultaneously. But it doesn't apply for window node pool only

To overcome this issue or mounting Azure Disk CSI driver to window node you need to provisoned or create the window node pool first. Please refer this MS tutorial to add a Windows node pool.

After you have a Windows node pool, you can now use the same built-in storage classes managed-csi to mount the DISK.

For more information and Validating Volume Mapping you can refer this MS Document

RahulKumarShaw
  • 4,192
  • 2
  • 5
  • 11