3

So I actually want to start my minikube cluster with a special directory mounted on it, on /data. This directory contains my db datas.

For this I try:

minikube start \
--driver=docker \
--extra-config=apiserver.service-node-port-range=1-35000 \
--disk-size=5000mb \
--mount \
--mount-string="${PWD}/srcs/mysql/datas:/data"

Actually options --mount and --mount-string="${PWD}/srcs/mysql/datas:/data" doesn't seem to works. No warning or error outputs are displayed but when I connect onto the machine and list files onto /data nothing appears. My directory is not mounted.

If I mount the directory with: minikube mount ${PWD}/srcs/mysql/datas:/data it works and I can list my data in /data. (But I really want to launch it at startup and now what I'm doing wrong).

nail0x
  • 43
  • 4
  • I am analyzing your issue. In a meantime, could you please try to run: `minikube start --driver=docker --extra-config=apiserver.service-node-port-range=1-35000 --disk-size=5000mb --mount --mount-string ${PWD}/srcs/mysql/datas:/data` and tell me if that works? Also, could you check with path with no `${PWD}`? You could use `~` instead to navigate from the home directory. – Wytrzymały Wiktor Dec 16 '20 at 18:22
  • i can confirm that it still does not work for on Ubuntu 20.04 with minikube v1.18.1 and KVM. It just creates an empty folder inside the VM but does not mount anything. – TekTimmy Apr 14 '21 at 13:14
  • I retried it after deleting Minikube configuration folder "~/.minikube" and updated to Minikube v1.19.0 and it works: `minikube start --mount --mount-string="$(pwd):/src"` – TekTimmy Apr 14 '21 at 13:22

1 Answers1

1

Posting this community wiki answer to indicate that the issue was resolved by:

I retried it after deleting Minikube configuration folder "~/.minikube" and updated to Minikube v1.19.0 and it works: minikube start --mount --mount-string="$(pwd):/src"


To check on the whole scenario, I've reproduced it with a following setup:

  • Ubuntu 20.04
  • Docker 20.10.7
  • KVM 4.2.1
  • Minikube:
    • v1.22.0 (tested both versions with the same steps)
    • v1.19.0

I'd reckon the issue was resolved not by deleting the ~/.minikube directory or upgrading minikube but rather than with a change to the destination folder that was mounted.

Assuming a following setup:

  • $ mkdir ~/test
  • $ echo "General Kenobi!" > ~/test/hello_there.txt
  • $ minikube start --mount --mount-string ~/test:/data
  • $ minikube ssh
  • $ ls -al /data
total 8
drwxr-xr-x 2 root root 4096 Jul 13 11:45 .
drwxr-xr-x 1 root root 4096 Jul 13 11:45 ..
  • $ minikube start --mount --mount-string ~/test:/src <-- notice the destination change
  • $ minikube ssh
  • $ ls -al /src <-- notice the destination change
total 12
drwxrwxr-x 2 1003 1004 4096 Jul 13 11:42 .
drwxr-xr-x 1 root root 4096 Jul 13 11:47 ..
-rw-rw-r-- 1 1003 1004   16 Jul 13 11:42 hello_there.txt

As it can be seen the files showed correctly when mounted to the directory other than /data.

A side note!

Above scenario was present only with the --driver=docker. --driver=kvm2 mounted the data to /data folder successfully.

This could be related to the persistency of some minikube's directories. More on that can be found here:

Another side note!

$ minikube mount with a /data as destination folder worked correctly.


Additional resources:

Dawid Kruk
  • 588
  • 2
  • 8