0

I have a on-prem network file share //server_name/share which I can map as network drive by providing credentials.

This path I am currently link with Azure VM's path /mnt/share and in this VM I am running docker container applications and further it will be mounted to container.

 - /mnt/share:/app/mnt

And finally my container application reading whatever available at //server_name/share.

Now I moved to Azure Kubernetes Service and here I am NOT able map path with my on-prem share //server_name/share.

What are the workaround for this issue? Azure File Sync I saw but this solution I don't want.

How to mount the share to the POD container?

Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
user584018
  • 10,186
  • 15
  • 74
  • 160

1 Answers1

0

You can setup your own NFS on the Kubernetes cluster if you are fine with that approach.

Or else you can mount the NFS file system to Kubernetes POD also.

for example :

volumeMounts:
         - name: nfs-volume
           mountPath: /var/your-destination

defining volume

volumes:
         - name: nfs-volum
nfs: 
           server: nfs-server.yourdomain.com
           path:/path/to/shared-folder

If you are looking for YAML for reference please check official examples : https://github.com/kubernetes/examples/tree/master/staging/volumes/nfs

if you are looking forward to setup the NFS on K8s cluster you can use the : https://www.gluster.org/

Or https://min.io/

If you are looking forward to create the PV using the NFS

apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs-pv
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  nfs:
    server: NFS server
    path: /home/shared
    readOnly: false
  storageClassName: nfs
  mountOptions: 
  - dir_mode=0777
  - file_mode=0777

https://docs.openshift.com/enterprise/3.1/install_config/persistent_storage/persistent_storage_nfs.html

Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102