<p>We have a docker image that is processing some files on a samba share.</p>
<p>For this we created a cifs share which is mounted to /mnt/dfs and files can be accessed in the container with:</p>
<pre><code>docker run -v /mnt/dfs/project1:/workspace image
</code></pre>
<p>Now what I was aked to do is get the container into k8s and to acces a cifs share from a pod a cifs Volume driver usiong FlexVolume can be used. That's where some questions pop up.</p>
<p>I installed this repo as a daemonset</p>
<p><a href="https://k8scifsvol.juliohm.com.br/" rel="nofollow noreferrer">https://k8scifsvol.juliohm.com.br/</a></p>
<p>and it's up and running.</p>
<pre><code>apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: cifs-volumedriver-installer
spec:
  selector:
    matchLabels:
      app: cifs-volumedriver-installer
  template:
    metadata:
      name: cifs-volumedriver-installer
      labels:
        app: cifs-volumedriver-installer
    spec:
      containers:
        - image: juliohm/kubernetes-cifs-volumedriver-installer:2.4
          name: flex-deploy
          imagePullPolicy: Always
          securityContext:
            privileged: true
          volumeMounts:
            - mountPath: /flexmnt
              name: flexvolume-mount
      volumes:
        - name: flexvolume-mount
          hostPath:
            path: /usr/libexec/kubernetes/kubelet-plugins/volume/exec/
</code></pre>
<p>Next thing to do is add a PeristentVolume, but that needs a capacity, 1Gi in the example. Does this mean that we lose all data on the smb server? Why should there be a capacity for an already existing server?</p>
<p>Also, how can we access a subdirectory of the mount /mnt/dfs from within the pod? So how to access data from /mnt/dfs/project1 in the pod?</p>
<p>Do we even need a PV? Could the pod just read from the host's mounted share?</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: mycifspv
spec:
  capacity:
    storage: 1Gi
  flexVolume:
    driver: juliohm/cifs
    options:
      opts: sec=ntlm,uid=1000
      server: my-cifs-host
      share: /MySharedDirectory
    secretRef:
      name: my-secret
  accessModes:
    - ReadWriteMany
</code></pre>

<p>No, that field has no effect on the FlexVol plugin you linked. It doesn't even bother parsing out the size you pass in :)</p>
