将Azure Files的文件夹挂载到Kubernetes吗? [英] Mount Azure Files' folder into Kubernetes?

查看:61
本文介绍了将Azure Files的文件夹挂载到Kubernetes吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关更多详细信息,请参见direct mount or persistent volume claim the Azure docs show how to mount an Azure Files storage account to a Kubernetes pod. This mounts the entire storage as the mounted path. How do I instead mount a folder within the Azure Files storage to Kubernetes?

On Azure Files, I have the following:

AzureFiles
|- folder1
   |- file1
|- folder2
   |- file2

When I mount the Azure Files storage account to Kubernetes (to /mnt/azure) I see this:

/mnt
|- azure
   |- folder1
      |- file1
   |- folder2
      |- file2

Instead I'd like to see this when I mount Azure Files' path folder1:

/mnt
|- azure
   |- file1

How do I change my Pod definition to specify this path:

apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
  - // ... snip ...
    volumeMounts:
      - name: azure
        mountPath: /mnt/azure
  volumes:
  - name: azure
    azureFile:
      secretName: azure-secret
      shareName: aksshare
      readOnly: false
      // TODO: how to specify path in aksshare

解决方案

Edit

Search for several days, I figure out how to mount a sub-folder of the Azure File Share to the AKS pod. You can set the yaml file like this:

volumes:
  - name: azure
    azureFile:
      secretName: azure-secret
      shareName: share/subfolder
      readOnly: false

Just set the share name with the directory, take care, do not append / in the end. The screenshot of the result is here:

For more details, see Naming and Referencing Shares, Directories, Files, and Metadata.

这篇关于将Azure Files的文件夹挂载到Kubernetes吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆