Updated README.md with minikube mount information

pull/1335/head
Aaron Prindle 2017-04-06 14:51:29 -07:00
parent 09e8cce24d
commit 0f6ffb76ab
1 changed files with 73 additions and 9 deletions

View File

@ -301,17 +301,81 @@ spec:
You can also achieve persistence by creating a PV in a mounted host folder.
## Mounted Host Folders
Some drivers will mount a host folder within the VM so that you can easily share files between the VM and host. These are not configurable at the moment and different for the driver and OS you are using. Note: Host folder sharing is not implemented in the KVM driver yet.
## Mounting Host Folders
`minikube mount /path/to/dir/to/mount` is the recommended way to mount directories into minikube so that they can be used in your local kubernetes cluster. The command works on all supported platforms. Below is an example workflow for using `minikube mount`:
| Driver | OS | HostFolder | VM |
| --- | --- | --- | --- |
| Virtualbox | Linux | /home | /hosthome |
| Virtualbox | OSX | /Users | /Users |
| Virtualbox | Windows | C://Users | /c/Users |
| VMWare Fusion | OSX | /Users | /Users |
| Xhyve | OSX | /Users | /Users |
```
# terminal 1
$ mkdir ~/mount-dir
$ minikube mount ~/mount-dir
Mounting /home/user/mount-dir/ into /mount-9p on the minikubeVM
This daemon process needs to stay alive for the mount to still be accessible...
ufs starting
# This process has to stay open, so in another terminal...
```
```
# terminal 2
$ echo "hello from host" > ~/mount-dir/hello-from-host
$ kubectl run -i --rm --tty ubuntu --overrides='
{
"apiVersion": "v1",
"kind": "Pod",
"metadata": {
"name": "ubuntu"
},
"spec": {
"containers": [
{
"name": "ubuntu",
"image": "ubuntu:14.04",
"args": [
"bash"
],
"stdin": true,
"stdinOnce": true,
"tty": true,
"workingDir": "/mount-9p",
"volumeMounts": [{
"mountPath": "/mount-9p",
"name": "host-mount"
}]
}
],
"volumes": [
{
"name": "host-mount",
"hostPath": {
"path": "/mount-9p"
}
}
]
}
}
' --image=ubuntu:14.04 --restart=Never -- bash
Waiting for pod default/ubuntu to be running, status is Pending, pod ready: false
Waiting for pod default/ubuntu to be running, status is Running, pod ready: false
# ======================================================================================
# We are now in the pod
#=======================================================================================
root@ubuntu:/mount-9p# cat hello-from-host
hello from host
root@ubuntu:/mount-9p# echo "hello from pod" > /mount-9p/hello-from-pod
root@ubuntu:/mount-9p# ls
hello-from-host hello-from-pod
root@ubuntu:/mount-9p# exit
exit
Waiting for pod default/ubuntu to terminate, status is Running
pod "ubuntu" deleted
# ======================================================================================
# We are back on the host
#=======================================================================================
$ cat ~/mount-dir/hello-from-pod
hello from pod
```
Some drivers themselves provide host-folder sharing options, but we plan to deprecate these in the future as they are all implemented differently and they are not configurable through minikube.
## Private Container Registries
**GCR/ECR**: Minikube has an addon, `registry-creds` which maps credentials into Minikube to support pulling from Google Container Registry (GCR) and Amazon's EC2 Container Registry (ECR). To use the addon, you will need to configure it using `minikube addons configure registry-creds` and then enable it via `minikube addons enable registry-creds`. If you need to automate this process, you can see the required secrets for the addon here: https://github.com/upmc-enterprises/registry-creds