Docker Kubernetes-无法在Azure文件共享上装载Windows路径(Linux装载工作正常)

Docker Kubernetes-无法在Azure文件共享上装载Windows路径(Linux装载工作正常),docker,kubernetes,azure-aks,kubernetes-pod,docker-volume,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 s

首先,我成功地在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那样出现在装载的共享上)

对于我尝试使用的装载路径:
C:\\host
C:/host
/C/host
同样对于shareName,我最初尝试使用
faselectaksshare/windows
,但它抛出了一个异常

在Pod Descripte中,我可以看到一切似乎都正常,但我期望的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
请帮忙!谢谢

更新: 我还尝试了使用子路径的这种方法,但我没有挂载任何文件夹。此外,我在日志或描述pod命令中没有得到任何错误

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

kubelet应该将Azure文件共享装载到容器中

它使用和

它使用SMB映射,然后使用mklink将Azure文件共享装载到容器中

请在Pod正在运行的Windows节点中启动kubelet,Azure文件共享应该使用--v 4标志装载,这样当它尝试将Azure文件共享装载到容器中时,我们可以在kubelet日志中看到调试消息。然后请在kubelet日志中提供消息。您应该看到以下来自的消息


Windows和Linux容器同时运行:

Linux的装载:

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

安装Windows:

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


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

根据以下线程,wsl2尚不支持hostPath卷

线程源: 请看以下评论:

试着换一行

 # For "C://host"
 mountPath: /run/desktop/mnt/host/c/host

对不起,我不明白如何才能提供更多信息?我看到您提供了一些代码的链接……”请在运行Pod的Windows节点中启动kubelet,Azure文件共享应该使用--v 4标志装载,以便在kubelet尝试装载时可以在kubelet日志中看到调试消息”您能否提供运行
kubectl apply-f.yaml
以部署具有应为其装载的卷的容器后应执行的详细步骤?谢谢你能告诉我你是如何将Windows节点添加到Kubernetes的吗?您是否使用kubeadm将Windows节点添加到Kubernetes?如果是,则按照,在C:\var\log\kubelet中创建kubelet日志文件,要使用--v 4标志启动kubelet,需要转到Windows节点上的services.msc,右键单击kubelet服务并打开属性。继续…然后停止kubelet服务,将--v4添加到启动参数并启动kubelet服务。这将在C:\var\log\kubelet中生成详细日志,然后您可以检查kubelet日志中的消息,因为kubelet是负责在Windows节点上装载Azure文件共享的进程。是否更新此问题?它能解决你的问题吗?如果它对你有效,请接受它。你解决问题了吗?我没有看到任何更新。你还在里面工作吗?
    volumeMounts:
    - name: azure
        mountPath: "C:\\fileshare"
volumes:
- name: azure
  azureFile:
  shareName: aksshare\windows
  secretName: azure-secret
 # For "C://host"
 mountPath: /run/desktop/mnt/host/c/host