我有一个用例,我需要 Kubernetes 下的 Docker 容器来访问 hostPath。我正在使用 minikube,容器能够访问 minikube VirtualBox VM 中的文件夹。但我不知道如何让它访问主机本身的文件夹。
我在主机上执行这些命令来创建 /opt/foo 以在 VM 中共享:
$ sudo touch /opt/foo/FOO
$ ls /opt/foo
FOO
$ minikube mount -v 5 /opt/foo:/opt/foo
Mounting /opt/foo into /opt/foo on the minikubeVM
This daemon process needs to stay alive for the mount to still be accessible...
ufs starting
在另一个窗口中,我查看了 minikube VM
$ minikube ssh -- sudo ls -la /opt/foo
total 0
drwxrwxr-x 2 root root 0 Jun 1 14:44 .
drwxr-xr-x 5 root root 0 Jun 1 14:44 ..
是否需要另一个步骤才能使该目录中的文件可访问?
仅供参考 - 用例是一个容器进程,它创建主机进程正在收集的文件。因此我不想使用 nfs 或 PersistentVolumes。主机是Centos7。minikube 版本:v0.19.0。