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

Unable to use external files for jobs through mounting #12304

Closed
mor619dx opened this issue Aug 18, 2021 · 3 comments · Fixed by #12319
Closed

Unable to use external files for jobs through mounting #12304

mor619dx opened this issue Aug 18, 2021 · 3 comments · Fixed by #12319
Labels
kind/improvement Categorizes issue or PR as related to improving upon a current feature. os/wsl-windows microsoft wsl related issues

Comments

@mor619dx
Copy link

mor619dx commented Aug 18, 2021

I'm using:
minikube start --driver=docker

I have a kubernetes yaml that runs a job that runs a pod which suppose to load data to a postgres database (another pod).

I'm running everything inside wsl 2.
The yaml is defined to use /mnt/AppData path on the local machine, when trying to use it I see that the pods are accessing the minikube vm /mnt/AppData instead of the local machine one.

Usually we put a file (for our new system installation) in that path and the script is accessing this file and using that file,
So I the pods can't access the local machine (wsl 2) storage for persistent or load of files.

I can't change the yaml files as this is our production files and we're using minikube for development purposes.

I saw some documentation on minikube mount command but it doesn't seem to work (returns an error):
stderr:
mount: /mnt: mount(2) system call failed: Connection refused.

How can I make my pods use and save files on my local machine? (through their defined volumes)

@andriyDev
Copy link
Contributor

Persistent Volumes and Persistent Volume Claims may work. I'm not too well versed in them, but they should mount a directory in your pods that is persistent across restarts or whatnot.

I'm not entirely sure why you want to mount stuff to the guest, since pods shouldn't be able to access the guest's directories. minikube mount is meant for more Kubernetes config stuff from what I've seen.

That said, failing to mount in WSL is not ideal and should be fixed. I need to look into it some more.

@andriyDev andriyDev added the kind/support Categorizes issue or PR as a support question. label Aug 20, 2021
@andriyDev
Copy link
Contributor

andriyDev commented Aug 20, 2021

@mor619dx Ok so I've done some playing around - minikube mount will not work by default. HOWEVER, it can work with the right args.

In your WSL, run ip addr and find the eth0 link's address. Let's say mine is 172.31.30.30. If you run minikube mount --ip 172.31.30.30, the files are indeed mounted on the guest. I'll look into making this the default behavior, but if your production files really need to access the host like that, it can.

Edit: These instructions were written for Ubuntu. I'm not sure what distrib you're using, but any distrib will have similar instructions. You just need to find the primary IP of WSL.

@andriyDev andriyDev added kind/improvement Categorizes issue or PR as related to improving upon a current feature. os/wsl-windows microsoft wsl related issues and removed kind/support Categorizes issue or PR as a support question. labels Aug 20, 2021
@mor619dx
Copy link
Author

Indeed it does fix it, the mounting goes out of sync if the pod is started before you call the mounting and so I used to mount when starting minikube:
minikube start --mount --mount-string="/mnt/AppData:/mnt/AppData" --driver=docker

it actually works without the --ip when I use it through the start command (so only required when calling minikube mount)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/improvement Categorizes issue or PR as related to improving upon a current feature. os/wsl-windows microsoft wsl related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants