Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

docker - Kubernetes - cannot have Windows path mounted on Azure File Share (Linux mounting works properly )

Firstly I succesfully mounted, my Linux path on Pod. I used azure file share and mounted folders appear on File Share.

    volumeMounts:
      - name: ads-filesharevolume
        mountPath: /opt/front/arena/host
  volumes:
  - name: ads-filesharevolume
    azureFile:
      secretName: fa-fileshare-secret
      shareName: faselectaksshare
      readOnly: false

Now on File Share I added one subfolder "windows" for mounting, in logs it mentions it is being mounted properly but I do not have anything mounted (folders and files do not appear on mounted share like it is the case for Linux)

   args: [ "-license_file", "C:/Host/dat/license.dat",
           "-key_file", "C:/Host/dat/license.key"]
    volumeMounts:
      - name: ads-win-filesharevolume
        mountPath: "C:\host"
  volumes:
  - name: ads-win-filesharevolume
    azureFile:
      secretName: fa-fileshare-secret
      shareName: faselectakssharewindows
      readOnly: false

For mountPath I tried with: C:\host and C:/host and /c/host Also for shareName I initially tried with faselectaksshare/windows but it threw an exception.

In Pod describe I can see that everything seems OK, but my expected folders from C:/host do not appear in my Azure File Share path in windows subfolder. I receive similar output for all other cases as well.

 Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-nx49r (ro)
      C:/host from ads-win-filesharevolume (rw)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  ads-win-filesharevolume:
    Type:        AzureFile (an Azure File Service mount on the host and bind mount to the pod)
    SecretName:  fa-fileshare-secret
    ShareName:   faselectakssharewindows
    ReadOnly:    false

Please help! Thanks

UPDATE: I also tried this approach with subPath and again I do not get any folders mounted. Also I do not get any error in log or in describe pod command

volumeMounts:
  - name: ads-filesharevolume
    mountPath: /host
    subPath: windows
  volumes:
  - name: ads-filesharevolume
    azureFile:
      secretName: fa-fileshare-secret
      shareName: faselectaksshare
      readOnly: false
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Both Windows and Linux containers run at the same time:

enter image description here

Mount for Linux:

    volumeMounts:
    - name: azure
      mountPath: /mnt/azure
volumes:
  - name: azure
    azureFile:
        shareName: aksshare/linux
        secretName: azure-secret

enter image description here

Mount for Windows:

    volumeMounts:
    - name: azure
        mountPath: "C:\fileshare"
volumes:
- name: azure
  azureFile:
  shareName: akssharewindows
  secretName: azure-secret

enter image description here

And the files that exist in each subfolder of the file share do not affect other ones.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

62 comments

56.6k users

...