docs: Update mount docs
Add the missing *Mount During Start* section to describe how to mount a directory when starting a cluster. This section describes the new virtiofs mounts introduced in minikube 1.37.0. Rename the *9p Mounts* section to *Mount Command* to make it more clear. This is an alternative for the *Mount During Start* if the user need to mount more than one directory or mount or unmount directories after the cluster was started. Remove the Kubernetes manifest example as it is not specific to mount command. Rename the *Driver Mount* section to *Driver Automatic Mounts* to make it more clear, and remove drivers that do not support this feature. Add *Driver Specific Mounts* for special mount options supported by specific drivers, currently only HyperKit. Reformat text tables to make the source easier to work with. Issues: - Missing `--mount-string` support on Windows and other drivers I'm not sure what works and/or tested and we have too many drivers[1] - Add section for using mounts in Kubernetes manifests? [1] https://minikube.sigs.k8s.io/docs/drivers/pull/21346/head
parent
9124b8ab6a
commit
d96d896eb7
|
|
@ -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