Kubernetes Pod giving my access denied when trying to write file to cifs mount

  cifs, docker, kubernetes

I’m working on a project the requires writing data to a cifs storage. I am use fstab/cifs flex volume. https://github.com/fstab/cifs

When I run the following yaml I get the error "sh: 1: cannot create /app/xxx/test.txt". I have confirmed the mount is mounting by doing an ls of the directory and it shows everything on the cifs storage. So why can’t a create a file? I’m sure the answer is gonna be something stupid I missed. Thanks in advanced for any help.

apiVersion: v1
kind: Pod
metadata:
   name: test
   namespace: xxx
spec:
   securityContext:
      fsGroup: 2000
   containers:
   - name: test
     image: "docker-repo.XXX.test:5000/xxx/test:latest"
     command: ['sh', '-c', 'echo test > /app/xxx/test.txt']
     securityContext:
        runAsUser: 1001
        runAsGroup: 2000
     volumeMounts:
     - name: exsnap
       mountPath: /app/xxx
   volumes:
   - name: exsnap
     flexVolume:
        driver: "fstab/cifs"
        fsType: "cifs"
        secretRef:
           name: "xxx-secret"
        options:
           networkPath: "//xxx.xxx.xxx.xxx/DATA/"
           mountOptions: "vers=2.0,dir_mode=0766,file_mode=0666,noperm"

Source: Docker Questions

LEAVE A COMMENT