Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS mount: mounted directory is empty #2481

Open
zhaytee opened this issue Jan 29, 2018 · 47 comments
Open

macOS mount: mounted directory is empty #2481

zhaytee opened this issue Jan 29, 2018 · 47 comments
Labels
area/mount cause/go9p-limitation Issues related to our go9p implementation help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. os/macos priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.

Comments

@zhaytee
Copy link

zhaytee commented Jan 29, 2018

Is this a BUG REPORT or FEATURE REQUEST?
Bug report

Please provide the following details:

Environment:

Minikube version: v0.25.0

  • OS: macOS 10.13.2
  • VM Driver: hyperkit
  • ISO version: v0.25.1
  • Others: kubernetes v1.7.5

What happened:
Tried to mount a host directory into a container. The directory inside the container is empty.

What you expected to happen:
The directory inside the container should give access to the mounted directory on the host. At least, that was the behavior when I was using minikube and VirtualBox!

How to reproduce it:

$ eval $(minikube docker-env)
$ mkdir test; cd test; echo 'hello' > test.txt
$ docker run --rm -it -v $(pwd):/testmount alpine
(now inside alpoine container)
/ # cd testmount
/testmount # ls -l
total 0

Anything else do we need to know:
Is this not possible when using hyperkit? If not, what is the alternative? I noticed some options relating to NFS, but I didn't dig too deeply. I'd prefer to just use the standard Docker volume mount mechanism if possible.

Thank you!

@parasyte
Copy link

Workaround this issue by using scp to copy the files into the VM:

scp -ri "$(minikube ssh-key)" "$PWD" docker@$(minikube ip):/tmp
docker run --rm -it -v /tmp:/testmount alpine

@r2d4 r2d4 added kind/bug Categorizes issue or PR as related to a bug. area/mount co/hyperkit Hyperkit related issues labels Mar 5, 2018
@sshilko
Copy link

sshilko commented Apr 13, 2018

With xhyve being deprecated would be great to get it fixed, virtualbox is slower for local environments. (i.e. minikube delete deletes all images cache and need to refetch again, while hyperkit caches them on host machine)

@fenos
Copy link

fenos commented May 10, 2018

I'm suffering this issue as well 😞

@alphabt
Copy link

alphabt commented May 17, 2018

+1 same issue here

@zhaytee
Copy link
Author

zhaytee commented Jun 29, 2018

This still appears to be an issue with minikube v0.28.0, k8s v1.10.0, and macOS 10.13.5. The hyperkit driver in general seems to be pretty solid now (although kubeadm doesn't work at all; localkube must be used), however without a mounting mechanism, minikube isn't useful for local development. Which kind of defeats the purpose.

Back to Virtualbox!

@ekimia
Copy link

ekimia commented Jul 18, 2018

any update on when a fix for this will be released? Agree with @zhaytee that this is a big blocker to use hyperkit. We are using xhye for now.

@dlorenc
Copy link
Contributor

dlorenc commented Jul 18, 2018

AFAIK the xhyve driver supports 9p or NFS mounts. Can you explain which one you're trying to use with hyperkit?

@ekimia
Copy link

ekimia commented Jul 18, 2018

@dlorenc just trying to do the standard mounts using hostPath. For xhyve and virtualbox, this is all thats needed since my mount point is already in Users. Below is a snippet of my deployment.yaml template:

{{ define "txechart.volumes"}}
      volumes:
      - name: txe-v
        hostPath:
          path: /Users/ek/myproject/code
{{- end }}

{{ define "txechart.volumeMounts"}}
          volumeMounts:
          - mountPath: /code
            name: txe-v
{{- end}}

@bw2
Copy link

bw2 commented Jul 23, 2018

Also seeing this issue in minikube v0.28.1

@jpswade
Copy link

jpswade commented Aug 8, 2018

Can replicate this issue in latest...

$ minikube version
minikube version: v0.28.2

@tstromberg tstromberg changed the title Can't mount host directories (macOS w/ hyperkit) HyperKit: mounted directory is empty Sep 20, 2018
@tstromberg
Copy link
Contributor

This definitely seems like a poor user experience. We need to do a deep dive to make mounts more reliable.

As a workaround, I suspect using VirtualBox as a a vm-driver may work, as it has a more robust mounting mechanism.

@itaysk
Copy link

itaysk commented Nov 18, 2018

still on v0.30.0

@sshilko
Copy link

sshilko commented Nov 19, 2018

just give up on windows

@jamescarson
Copy link

Still on version: v0.32.0

VirtualBox is working fine but poor performance.

@tstromberg tstromberg added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Jan 24, 2019
@kevinkirkup
Copy link

Still an issue on v0.33.1

@mkempster
Copy link

It's a poor workaround to be sure, but this command left running in a terminal

minikube mount /Users:/Users

Seems to make the above testcase work as expected

docker run --rm -it -v $(pwd):/testmount alpine

@AnthonyNixon
Copy link

Still an issue on v1.0.0

@tstromberg tstromberg added the r/2019q2 Issue was last reviewed 2019q2 label May 22, 2019
@tstromberg tstromberg added the cause/go9p-limitation Issues related to our go9p implementation label Jul 18, 2019
@tstromberg
Copy link
Contributor

I'm curious, for those of you who are seeing this - is this occurring with a directory that contains more than 600 files?

If so, it may be related to #1753

@MaurGi
Copy link

MaurGi commented Aug 5, 2019

the Mac /Users folder is not getting mounted, this still happens in 1.2.0 and on Mac OS 10.14.5:

> docker-machine-driver-hyperkit version
This is a Docker Machine plugin binary.
Plugin binaries are not intended to be invoked directly.
Please use this plugin through the main 'docker-machine' binary.
(API version: 1)
> hyperkit -v
hyperkit: v0.20180403-41-g64bbfb

Homepage: https://github.com/docker/hyperkit
License: BSD
> minikube version          
minikube version: v1.2.0
> minikube start  
😄  minikube v1.2.0 on darwin (amd64)
👍  minikube will upgrade the local cluster from Kubernetes 1.14.0 to 1.15.0
💿  Downloading Minikube ISO ...
 129.33 MB / 129.33 MB [============================================] 100.00% 0s

⚠️  Ignoring --vm-driver=virtualbox, as the existing "minikube" VM was created using the hyperkit driver.
⚠️  To switch drivers, you may create a new VM using `minikube start -p <name> --vm-driver=virtualbox`
⚠️  Alternatively, you may delete the existing VM using `minikube delete -p minikube`

🔄  Restarting existing hyperkit VM for "minikube" ...
⌛  Waiting for SSH access ...
🐳  Configuring environment for Kubernetes v1.15.0 on Docker 18.06.2-ce
💾  Downloading kubelet v1.15.0
💾  Downloading kubeadm v1.15.0
🚜  Pulling images ...
🔄  Relaunching Kubernetes v1.15.0 using kubeadm ... 
⌛  Verifying: apiserver proxy etcd scheduler controller dns
🏄  Done! kubectl is now configured to use "minikube"
> minikube ssh
                         _             _            
            _         _ ( )           ( )           
  ___ ___  (_)  ___  (_)| |/')  _   _ | |_      __  
/' _ ` _ `\| |/' _ `\| || , <  ( ) ( )| '_`\  /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )(  ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)

$ ls
$ ls /
bin  data  dev  etc  home  init  lib  lib64  linuxrc  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
$ exit
logout

@tstromberg tstromberg changed the title HyperKit: mounted directory is empty macOS: mounted directory is empty Sep 20, 2019
@spowelljr spowelljr reopened this Mar 17, 2021
@spowelljr spowelljr added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels Mar 17, 2021
@riklopfer
Copy link

I do not have the same problem when running with the virtualbox driver. Maybe virtual box should be flagged as the preferred driver instead of Docker: https://minikube.sigs.k8s.io/docs/drivers/

$ minikube start --driver=virtualbox --cpus 4 --memory 8196
😄  minikube v1.18.1 on Darwin 11.2.3
    ▪ MINIKUBE_ACTIVE_DOCKERD=minikube
✨  Using the virtualbox driver based on user configuration
👍  Starting control plane node minikube in cluster minikube
🔥  Creating virtualbox VM (CPUs=4, Memory=8196MB, Disk=20000MB) ...
🐳  Preparing Kubernetes v1.20.2 on Docker 20.10.3 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
🔎  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v4
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

$ eval $(minikube docker-env)
$ mkdir test; cd test; echo 'hello' > test.txt
$ docker run --rm -it -v $(pwd):/testmount alpine
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
ba3557a56b15: Pull complete
Digest: sha256:a75afd8b57e7f34e4dad8d65e2c7ba2e1975c795ce1ee22fa34f8cf46f96a3be
Status: Downloaded newer image for alpine:latest
/ # ls -l /testmount/
total 4
-rw-r--r--    1 1000     1000             6 Mar 23 19:17 test.txt
/ #

@sharifelgamal
Copy link
Collaborator

@riklopfer This issue is about using the minikube mount command to mount files from your local filesystem into the minikube VM or container. What you are doing is not the same thing. I believe minikube mount now works for macOS on all drivers.

@riklopfer
Copy link

@sharifelgamal I am running the commands which were originally reported to reproduce this issue (see #2481 (comment)) . Perhaps this issue changed subject at some point. If this should be tracked elsewhere, #10851 can be reopened.

@legend-zeratul
Copy link

Issue happens on arch - docker driver as well. Mounting the folder manually works, able to see the contents, mount at start doesnt..

@legend-zeratul
Copy link

My Minikube version is: v1.18.1
Docker version: 20.10.5
OS: Endeavour (Arch base)
Linux Kernel: 5.4.101-1-lts54

Currently working by manually running the mount command after start, but shouldnt this be at start?

@sharifelgamal
Copy link
Collaborator

@legend-zeratul to be clear, it's the --mount and --mount-string parameters for minikube start that's not working for you?

@sharifelgamal sharifelgamal removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Apr 28, 2021
@legend-zeratul
Copy link

OK, let me add a more detailed description..

For development, say I'm building appX and as part of containerising the app, I've moved out all persistent stores into a set of folders, say, dataX.. As I've understood, the base dataX folder needs to be mounted into the minikube's /data directory (for example), and the app's persistent volumes refer to this /data directory in their descriptors.. As part of normal dev cycles, anyone would need the ability to mount, unmount this directory and undeploy/deploy the containers independently.. The expectation would also be that if the local machine is restarted, the folder is automatically re-mounted when minikube starts..

While I understand local folder mounts are a security risk in integration/staging/production type setups, a local dev setup (minikube's focus domain) should be fine with local folder mounts, so the expectation would be to make this as seamless as possible to ease development time activities..

Problems:

  • Mount folders need to be specified at cluster creation time, in order for the mount to work.. Trying to add a mount folder after the cluster is created doesnt work (both with/without the kill=true flag, if I remember correctly).. (I lost 3 days trying to understand why it worked one day and it didnt work the next)
  • Dev time activities would not expect a terminal process to be kept running - so these will most likely use the kill=true flag..
  • Restarting minikube should auto-mount the folder specified to /data.. (currently it doesnt). This adds an extra layer of complexity for the data-db-init folder that sql databases use because now when minikube starts - the /data folder is empty, the containers that depend on this folder now assume that the DB needs to be reinitialized, leading to interesting scenarios..
  • I found the cluster config json's location later - so I dont know if editing the cluster config itself works or not.. (in other words - is the bug in the parameter processing, or is it in the mount part of the code.. ..need to test)

Docker stack does the expected behaviour very very nicely.. Restarting brings everything up to where it was..

The sequence that does work:

  • Specify the mount folders at cluster creation time
  • Use minikube mount once without the kill=true flag, then Ctrl+C to kill the process..
  • Re-mount with the kill=true flag..

(looks like a weird issue - if the second step is skipped and we attempt a minikube mount with the kill=true flag directly, the mount process exits successfully, but the /data folder is empty (not correctly mounted))

The above sequence gets a working cluster with the folders mounted, however bringing down the cluster needs the entire sequence to be repeated (without kill=true and then with kill=true) for the data folders to get mounted.. You can imagine the fun that we will now have when service containers -> need persistent volume claims -> need persistent volumes -> need /data folder mounted: restarting the cluster or the machine as a result requires us to undeploy/deploy everything - this is the point when this stopped being workable..

Hope that helps - open to helping out with testing a patch if needed.. Do let me know.. (dont hv a local source->compile build setup, but will figure that out when needed).

Thanks.

@spowelljr spowelljr added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Jun 9, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 7, 2021
@spowelljr spowelljr added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 7, 2021
@d3vpasha
Copy link

This issue is still active

@sylvain-combe-sonarsource

Very unreliable 9P mounts on Hyperkit, MacOS 11.6 and minikube 1.23.1
Some files present and with 444 permissions in my host file system are unseen from the container mounting the dir, while some of those files are seen as directories...
File flags and attributes are a mess I would say.

I was planning to replace docker desktop with minikube but migration of existing volumes has been very difficult so far, because of these minikube bugs.

@lubumbax
Copy link

More than three years since this issue was opened...
it is still reproducible under Minikube v1.24.0 and Hyperkit 0.20200908

@spowelljr spowelljr added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels Mar 16, 2022
@alokarora0702
Copy link

Its still an issue even on HyperV, you mount at start and then it simply stops working after some time, while you are updating some PODs using the same volume

@spowelljr spowelljr added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed priority/backlog Higher priority than priority/awaiting-more-evidence. labels May 25, 2022
@DmytroLopushanskyy
Copy link

I had a similar problem on M1 Mac and ended up solving it using this command:

minikube mount /Users:/Users

@scottiedog45
Copy link

One thing to note, after running minikube mount command, it started working for me when I changed the referenced paths in the manifest to be the target dir of the minikube mount command, like in this example (notice /host is in the manifest, vs the path of the host)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mount cause/go9p-limitation Issues related to our go9p implementation help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. os/macos priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Projects
None yet
Development

No branches or pull requests