首页 > 解决方案 > 用于挂载 Azure Blob 容器共享的 Yaml 配置

问题描述

如何在 Yaml 上配置 Azure Blob 存储容器

   - name: scripts-file-share
     azureFile:
         secretName: dev-blobstorage-secret
         shareName: logs
         readOnly: false```

The above is for the logs file share to configure on yaml.
But if I need to mount blob container? How to configure it?

Instead of azureFile do I need to use azureBlob?
And what is the configuration that I need to have below azureBlob? Please help

标签: azurekubernetesyamlazure-blob-storage

解决方案


在我从上面的帖子中得到回复并浏览了在线文章之后,我发现 Azure Blob 没有选项可以安装在 Azure AKS 上,除非考虑到我的环境限制,我可以使用 azcopy 或 rest api 集成来解决我的问题.

因此,经过一些研究并从下面的文章中获取参考,我可以创建一个 Docker 映像。

1.) 使用参考文章创建了 docker 镜像。但同样,我也需要支持来运行 bash 脚本,因为我正在使用 bash 文件运行 azcopy 命令。因此,我尝试将 azcopy 工具复制到 /usr/bin。

2.) 为 Azure 文件共享和 Azure Blob 创建了 SAS 令牌。(确保您仅授予所需的访问权限)

3.) 创建了一个运行以下命令的 bash 文件。

azcopy <FileShareSASTokenConnectionUrl> <BlobSASTokenConnectionUrl> --recursive=true

4.) 创建了在 AKS 上运行的部署 yaml。在其中添加了运行 bash 文件的命令。

这使我能够将文件从 Azure 文件共享文件夹复制到 Azure Blob 容器

参考:

1.) https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10?toc=%2fazure%2fstorage%2fblobs%2ftoc.json#obtain-a-static-下载链接

2.) https://github.com/Azure/azure-storage-azcopy/issues/423


推荐阅读