Merge d96d896eb7 into d5796e6cc5
commit
5226df1b41
|
|
@ -8,79 +8,88 @@ aliases:
|
|||
- /docs/tasks/mount
|
||||
---
|
||||
|
||||
## 9P Mounts
|
||||
## Mount During Start
|
||||
|
||||
9P mounts are flexible and work across all hypervisors, but suffers from performance and reliability issues when used with large folders (>600 files). See **Driver Mounts** as an alternative.
|
||||
To mount a directory from the host into the guest using the `start` subcommand
|
||||
use the `--mount-string` flag:
|
||||
|
||||
```shell
|
||||
minikube start --mount-string <host directory>:<guest directory>
|
||||
```
|
||||
|
||||
For example, this would mount your `~/models` directory to appear as
|
||||
`/mnt/models` within the minikube VM.
|
||||
|
||||
```shell
|
||||
minikube start ~/models:/mnt/models
|
||||
```
|
||||
|
||||
The directory remains mounted while the cluster is running.
|
||||
|
||||
The mount will use the best method supported by the driver:
|
||||
|
||||
| Driver | OS | Method | Notes |
|
||||
|----------------|---------|------------------|------------------------|
|
||||
| docker | Linux | container volume | |
|
||||
| podman | Linux | container volume | |
|
||||
| kvm | Linux | 9p | |
|
||||
| Vfkit | macOS | virtiofs | Since minikube 1.37.0 |
|
||||
| Krunkit | macOS | virtiofs | Since minikube 1.37.0 |
|
||||
| qemu | macOS | 9p | |
|
||||
|
||||
The `--mount-string` flag supports only a single mount. If you want to mount
|
||||
additional directories, or mount and unmount directories after the cluster was
|
||||
started see [Mount Command](#Mount-command).
|
||||
|
||||
## Mount Command
|
||||
|
||||
The mount command allows mounting and unmounting directories after the minikube
|
||||
cluster was started using the *9p* filesystem. The command works with all VM
|
||||
drivers.
|
||||
|
||||
To mount a directory from the host into the guest using the `mount` subcommand:
|
||||
|
||||
```shell
|
||||
minikube mount <source directory>:<target directory>
|
||||
minikube mount <host directory>:<guest> directory>
|
||||
```
|
||||
|
||||
For example, this would mount your home directory to appear as /host within the minikube VM:
|
||||
For example, this would mount your `~/models` directory to appear as
|
||||
`/mnt/models` within the minikube VM:
|
||||
|
||||
```shell
|
||||
minikube mount $HOME:/host
|
||||
minikube mount ~/models:/mnt/models
|
||||
```
|
||||
|
||||
This directory may then be referenced from a Kubernetes manifest, for example:
|
||||
The directory remains mounted while the mount command is running. To unmount the
|
||||
directory terminate the mount command with `Control+C`.
|
||||
|
||||
```shell
|
||||
{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Pod",
|
||||
"metadata": {
|
||||
"name": "ubuntu"
|
||||
},
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "ubuntu",
|
||||
"image": "ubuntu:18.04",
|
||||
"args": ["bash"],
|
||||
"stdin": true,
|
||||
"stdinOnce": true,
|
||||
"tty": true,
|
||||
"workingDir": "/host",
|
||||
"volumeMounts": [
|
||||
{
|
||||
"mountPath": "/host",
|
||||
"name": "host-mount"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"volumes": [
|
||||
{
|
||||
"name": "host-mount",
|
||||
"hostPath": {
|
||||
"path": "/host"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
*9p* mounts are flexible and work across all hypervisors, but suffers from
|
||||
performance and reliability issues when used with large folders (>600 files).
|
||||
See [Driver Automatic Mounts](#driver-automatic-mounts) and
|
||||
[Driver Specific Mounts](#driver-specific-mounts) as alternatives.
|
||||
|
||||
## Driver mounts
|
||||
## Driver automatic mounts
|
||||
|
||||
Some hypervisors, have built-in host folder sharing. Driver mounts are reliable with good performance, but the paths are not predictable across operating systems or hypervisors:
|
||||
Some hypervisors, have built-in host folder sharing. Driver mounts are reliable
|
||||
with good performance, but the paths may differ across operating systems or
|
||||
hypervisors:
|
||||
|
||||
| Driver | OS | HostFolder | VM |
|
||||
| --- | --- | --- | --- |
|
||||
| VirtualBox | Linux | /home | /hosthome |
|
||||
| VirtualBox | macOS | /Users | /Users |
|
||||
| VirtualBox | Windows | C://Users | /c/Users |
|
||||
| VMware Fusion | macOS | /Users | /mnt/hgfs/Users |
|
||||
| KVM | Linux | Unsupported | |
|
||||
| HyperKit | macOS | Supported | |
|
||||
| Driver | OS | Host | Guest |
|
||||
|----------------|---------|--------------|-------------------|
|
||||
| VirtualBox | Linux | /home | /hosthome |
|
||||
| VirtualBox | macOS | /Users | /Users |
|
||||
| VirtualBox | Windows | C://Users | /c/Users |
|
||||
| VMware Fusion | macOS | /Users | /mnt/hgfs/Users |
|
||||
|
||||
These mounts can be disabled by passing `--disable-driver-mounts` to `minikube start`.
|
||||
Built-in mounts can be disabled by passing the `--disable-driver-mounts` flag to
|
||||
`minikube start`.
|
||||
|
||||
HyperKit mounts can use the following flags:
|
||||
`--nfs-share=[]`: Local folders to share with Guest via NFS mounts
|
||||
`--nfs-shares-root='/nfsshares'`: Where to root the NFS Shares, defaults to /nfsshares
|
||||
## Driver Specific Mounts
|
||||
|
||||
HyperKit driver can also use the following start flags:
|
||||
- `--nfs-share=[]`: Local folders to share with Guest via NFS mounts
|
||||
- `--nfs-shares-root='/nfsshares'`: Where to mount the NFS Shares, defaults to
|
||||
`/nfsshares`
|
||||
|
||||
## File Sync
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue