How to mount volumes into Windows-based pods?

I set up a small Kubernetes cluster for testing, and for storage I use glusterfs. No CSI, I just create the volumes manually for now.

Now, I added a Windows node to the cluster. It works fine so far, but I can’t get any volumes to mount in the container.

I did a very simple pod definition:

---
apiVersion: v1
kind: Pod
metadata:
  name: windows-test
  labels:
    name: windows-test
spec:
  containers:
    - name: sample
      image: mcr.microsoft.com/windows/servercore:ltsc2019
      resources:
        limits:
          cpu: "1.0"
          memory: "1Gi"
      command:
        - cmd
        - "/c"
        - "dir"
        - "/s"
        - 'c:\'
      volumeMounts:
        - mountPath: "foo"
          name: testvol
  nodeSelector:
    "kubernetes.io/os": windows
  volumes:
    - name: testvol
      glusterfs:
        path: wintest
        endpoints: glusterfs-cluster
        readOnly: false

When I run this, the pod never starts and when I describe it, I get:
Warning FailedMount <invalid> kubelet, node09 MountVolume.SetUp failed for volume "testvol" : mount failed: only cifs mount is supported now, fstype: "glusterfs", mounting source ("10.93.111.35:wintest"), target ("c:\\var\\lib\\kubelet\\pods\\6d207138-09fb-4e1f-86e7-6a71cef5ce7e\\volumes\\kubernetes.io~glusterfs\\testvol"), with options (["auto_unmount" "backup-volfile-servers=10.93.111.31:10.93.111.32:10.93.111.33:10.93.111.34:10.93.111.35:10.93.111.36:10.93.111.37:10.93.111.38" "log-file=\\var\\lib\\kubelet\\plugins\\kubernetes.io\\glusterfs\\testvol\\windows-test-glusterfs.log" "log-level=ERROR"]), the following error information was pulled from the glusterfs log to help diagnose this issue: could not open log file for pod windows-test

It seems that Windows pods do not support glusterfs, but only “cifs”. Can anyone guide me how to mount a volume via cifs? The only information I found in the docs was about the azure-file storage but I couldn’t figure out if that can also mount CIFS shares on-prem.

For CIFS Volumes, I’ve been configuring Persistent Volumes to use this plugin: https://github.com/Azure/kubernetes-volume-drivers/blob/94428fb110fdab8880343917651b1cc0763f80af/flexvolume/smb/deployment/smb-flexvol-installer/smb

On Startup each node sets:

DEFAULT_PLUGIN_DIR=/usr/libexec/kubernetes/kubelet-plugins/volume/exec/microsoft.com~smb/

And then copies the smb script to that location and makes it executable.

I also added this flag to Kubelet Extra Args

--enable-controller-attach-detach

Overall it has worked very well

Edit- it just occurred to me that you are doing this on your windows nodes, and so I don’t know if that plugin would work properly in that case. I guess I’ll leave this answer anyway because it would help someone who is trying to mount CIFS volumes on Linux hosts