docker - Kubernetes - 无法在 Azure 文件共享上安装 Windows 路径(Linux 安装正常)

标签 docker kubernetes azure-aks kubernetes-pod docker-volume

首先,我成功挂载了我在 Pod 上的 Linux 路径。 我使用了 Azure 文件共享,并且挂载的文件夹出现在文件共享上。

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

现在在文件共享上我添加了一个子文件夹“windows”用于安装,在日志中它提到它正在正确安装但我没有安装任何东西(文件夹和文件不会出现在安装的共享上,就像 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: faselectaksshare\windows
      readOnly: false

对于 mountPath,我尝试使用:C:\\hostC:/host/c/host 同样对于 shareName,我最初尝试使用 faselectaksshare/windows 但它引发了异常。

在 Pod describe 中,我可以看到一切正常,但我预期的 C:/host 文件夹没有出现在我的 Windows 子文件夹中的 Azure 文件共享路径中。对于所有其他情况,我也收到类似的输出。

 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:   faselectaksshare\windows
    ReadOnly:    false

求助!谢谢

更新: 我也用 subPath 尝试过这种方法,但我没有安装任何文件夹。我也没有在日志或 describe pod 命令中收到任何错误

volumeMounts:
  - name: ads-filesharevolume
    mountPath: /host
    subPath: windows
  volumes:
  - name: ads-filesharevolume
    azureFile:
      secretName: fa-fileshare-secret
      shareName: faselectaksshare
      readOnly: false

最佳答案

Windows 和 Linux 容器同时运行:

enter image description here

Linux 挂载:

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

enter image description here

为 Windows 安装:

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

enter image description here

并且文件共享的每个子文件夹中存在的文件不会影响其他文件。

关于docker - Kubernetes - 无法在 Azure 文件共享上安装 Windows 路径(Linux 安装正常),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66709259/

相关文章:

Docker 更新后 Mysql 表丢失 : "TableName doesn' t exist in engine"

docker - 是否有docker API或exec.Command方式从给定的容器名称(而不是容器列表)中检索容器ID?

kubernetes - 如何安装特定版本的 Kubernetes?

azure - az aks get-credentials 使用自定义 ssh key ?

带有自托管代理的azure devops : can't deploy to aks cluster

docker - Docker日志在Ubuntu Linux Mint中的位置

kubernetes - 无法创建 pod 沙箱 : rpc error: code = Unknown desc = failed to set up sandbox container

c# - 无法从程序集“Microsoft.Azure.WebJobs.Host”加载类型 'Microsoft.Azure.WebJobs.Host.Scale.ConcurrencyManager'

Azure Kubernetes 服务 ARM 模板不是幂等的

sed - 如何从检查 docker 容器中获取暴露的端口?