You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将本地文件夹挂载到Rancher Desktop创建的Kubernetes集群?

在macOS的Rancher Desktop中挂载本地目录到Kubernetes集群

1. 定位Lima配置文件

在macOS终端中,进入Rancher Desktop的Lima配置目录:

cd ~/.rd/lima/_config/

如果目录下没有override.yaml文件,直接创建:

touch override.yaml

2. 编写挂载配置

用文本编辑器打开override.yaml,写入以下配置(替换为你的实际路径):

mounts:
  - location: "/Users/me/data"
    writable: true
    mountPoint: "/data"
  • location: 本地macOS需要挂载的文件夹绝对路径
  • writable: 设置为true允许集群对挂载目录进行读写操作
  • mountPoint: 集群节点内的目标挂载路径

3. 重启Rancher Desktop生效

在Rancher Desktop应用中,点击右上角菜单选择Quit Rancher Desktop,重新打开应用后等待集群重启完成。

4. 验证挂载结果

可以通过两种方式确认:

  • 进入集群节点shell:
    rdctl shell
    
    执行ls /data,检查内容是否和本地/Users/me/data一致。
  • 通过kubectl调试节点:
    kubectl debug node/rancher-desktop -it --image=alpine
    
    在调试容器内执行ls /data,验证目录内容匹配。

内容的提问来源于stack exchange,提问作者Hongbo Miao

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 17:40:29