SMB share mounted on Kubernetes but not content is visible (files or directories)

7/20/2021

I have SMB share on windows which I'm trying to mount on Kubernetes as a persistent volume. I used this cifs plugin https://github.com/fstab/cifs and mounted the share on the pod. In the running pod when do a "ls" in the share folder I don't see any of the share content but I'm able to cd into the directories and also cat the files inside the share. The paths are valid but browsing through the content is not working.

I use the pod yaml provided below :

apiVersion: v1
kind: Pod
metadata:
  name: busybox
  namespace: default
spec:
  containers:
   - name: busybox
   image: busybox
 command:
   - sleep
   - "3600"
imagePullPolicy: IfNotPresent
volumeMounts:
- name: test
  mountPath: /data
volumes:
 - name: test
flexVolume:
  driver: "fstab/cifs"
  fsType: "cifs"
  secretRef:
    name: "cifs-secret"
  options:
    networkPath: "//server/share"
    mountOptions: "dir_mode=0755,file_mode=0755,noperm"
-- Sai Raghuram Kaligotla
cifs
kubernetes
samba
smb

1 Answer

7/20/2021

I understand that you need to set up the correct permission for the folder using dir_mode=0755 and file_mode=0755:

sudo mount -t cifs credentials=<credentials-files>,dir_mode=0755,file_mode=0755 //WIN_SHARE_IP/<share_name> /mnt/share

You can visit this page for more info.

-- J.Vander
Source: StackOverflow