Resolved: How to mount a windows share to a pod and into linux container inside a linux host (Windows share is behind proxy auth.)

Question:

Hello i’m trying to mount a windows share to a linux container. The way i’m trying to do this:
  • Mount windows share to kubernetes pod (running in linux machine)
  • Mount that drive into linux container

I run into a brick wall after trying lots of solutions. Last thing i tried was to edit kubernetes config.yml to mount drives the way i want. But i don’t know or find any way to pass proxy credentials to config.yml
My config file (Example of how i’m trying to do. Original file is too long.):
spec:
  containers:
    name: app
    securityContext:
      capabilities:
        add:
        - SYS_ADMIN
        - DAC_READ_SEARCH
    volumeMounts:
    - mountPath: /mount/winshare
      name: nfs-volume
  volumes:
  - name: nfs-volume
    nfs:
      path: /E8_iT-Consultants/Upload
      server: <--server--Ip-->
How can I add credentials under “volumes:” tag? Is there a way to achieve what I want to do in any other way? I’m open to any suggestions.

Answer:

Windows shares are using CIFS protocol, not NFS. NFS is not using login/password for authentication/authorization, its trust model is based on IP addresses of clients, and on Kerberos tokens in some more advanced configurations, so you can’t provide any credentials when using NFS.
There is no out-of-the box support for CIFS in kubernetes, but there is a community project that implements flexvolume plugin – https://github.com/fstab/cifs
See Accessing CIFS files from pods for more details on how to use this plugin.

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com