This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.6.3.7. 配置卷以在 pod 中用于多种用途
您可以使用 volumeMounts.subPath
属性来指定卷中的 subPath
而非卷的根目录,将卷配置为允许在一个 pod 中多处使用这个卷。
流程
运行
oc rsh
命令来查看卷中的文件列表:oc rsh <pod>
$ oc rsh <pod>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
ls /path/to/volume/subpath/mount
sh-4.2$ ls /path/to/volume/subpath/mount example_file1 example_file2 example_file3
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 指定
subPath
:带有
subPath
参数的Pod
spec 示例Copy to Clipboard Copied! Toggle word wrap Toggle overflow