简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM