Skip to content

Support multi mount-string #21056

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Support multi mount-string #21056

wants to merge 2 commits into from

Conversation

bugwz
Copy link

@bugwz bugwz commented Jul 11, 2025

When using minikube start, we can pass in multiple paths that we want to mount inside the container through the mount-string parameter, for example:

minikube start --mount --mount-string="/data01:/data01;/data02:/data02:Z,rshared"

Copy link

linux-foundation-easycla bot commented Jul 11, 2025

CLA Signed


The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jul 11, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bugwz
Once this PR has been reviewed and has the lgtm label, please assign comradeprogrammer for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

Welcome @bugwz!

It looks like this is your first PR to kubernetes/minikube 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/minikube has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 11, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @bugwz. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jul 11, 2025
@medyagh
Copy link
Member

medyagh commented Jul 11, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 11, 2025
@medyagh
Copy link
Member

medyagh commented Jul 11, 2025

@bugwz can you plz share Before/After this PR output of minikube?

@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 21056) |
+----------------+----------+---------------------+
| minikube start | 51.9s    | 53.6s               |
| enable ingress | 15.3s    | 15.4s               |
+----------------+----------+---------------------+

Times for minikube start: 51.3s 52.9s 51.4s 52.5s 51.6s
Times for minikube (PR 21056) start: 58.1s 53.1s 51.7s 52.8s 52.2s

Times for minikube (PR 21056) ingress: 14.6s 16.2s 16.1s 15.1s 15.1s
Times for minikube ingress: 15.1s 16.1s 15.6s 14.6s 15.1s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 21056) |
+----------------+----------+---------------------+
| minikube start | 25.3s    | 25.2s               |
| enable ingress | 12.9s    | 13.1s               |
+----------------+----------+---------------------+

Times for minikube start: 24.8s 27.4s 23.4s 26.9s 23.9s
Times for minikube (PR 21056) start: 25.8s 24.3s 23.6s 26.4s 26.0s

Times for minikube ingress: 13.8s 12.8s 11.3s 13.3s 13.4s
Times for minikube (PR 21056) ingress: 13.3s 13.3s 13.3s 12.8s 12.8s

docker driver with containerd runtime

+-------------------+----------+---------------------+
|      COMMAND      | MINIKUBE | MINIKUBE (PR 21056) |
+-------------------+----------+---------------------+
| minikube start    | 22.8s    | 23.3s               |
| ⚠️  enable ingress | 23.5s    | 32.8s ⚠️             |
+-------------------+----------+---------------------+

Times for minikube start: 25.2s 21.2s 21.8s 21.5s 24.0s
Times for minikube (PR 21056) start: 24.1s 23.8s 22.5s 22.2s 24.0s

Times for minikube (PR 21056) ingress: 39.8s 22.8s 38.9s 38.9s 23.8s
Times for minikube ingress: 24.4s 23.8s 22.8s 23.8s 22.8s

@bugwz
Copy link
Author

bugwz commented Jul 12, 2025

@medyagh Below is the comparison information, please take a look~

Before:

[bugwz@iZj6cibr8kn3thfefwcyg3Z minikube]# ./out/minikube version
minikube version: v1.36.0
commit: 78989b99c29903d39ba5a8f2a0fef52d8b2c4497

[bugwz@iZj6cibr8kn3thfefwcyg3Z minikube]# ./out/minikube start --help
...
    --mount-string='/home/bugwz:/minikube-host':
	The argument to pass the minikube mount command on start.
...

[bugwz@iZj6cibr8kn3thfefwcyg3Z minikube]$ ./out/minikube start --driver="podman" --mount --mount-string="/data01:/data01"
😄  minikube v1.36.0 on Centos 8.5.2111 (amd64)
✨  Using the docker driver based on user configuration

💣  Exiting due to PROVIDER_DOCKER_VERSION_EXIT_1: "docker version --format <no value>-<no value>:<no value>" exit status 1: Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
time="2025-07-12T12:19:12+08:00" level=error msg="XDG_RUNTIME_DIR directory \"/run/user/0\" is not owned by the current user"
📘  Documentation: https://minikube.sigs.k8s.io/docs/drivers/docker/

[bugwz@iZj6cibr8kn3thfefwcyg3Z minikube]$ ./out/minikube start --driver="podman" --mount --mount-string="/data01:/data01"
😄  minikube v1.36.0 on Centos 8.5.2111 (amd64)
❗  The minimum required version for podman is "4.9.0". your version is "3.3.1". minikube might not work. use at your own risk. To install latest version please see https://podman.io/getting-started/installation.html
✨  Using the podman driver based on user configuration

🧯  The requested memory allocation of 3072MiB does not leave room for system overhead (total system memory: 3625MiB). You may face stability issues.
💡  Suggestion: Start minikube with less memory allocated: 'minikube start --memory=3072mb'

📌  Using Podman driver with root privileges
👍  Starting "minikube" primary control-plane node in "minikube" cluster
🚜  Pulling base image v0.0.47 ...
💾  Downloading Kubernetes v1.33.2 preload ...
    > preloaded-images-k8s-v18-v1...:  348.11 MiB / 348.11 MiB  100.00% 10.32 M
    > gcr.io/k8s-minikube/kicbase...:  502.26 MiB / 502.26 MiB  100.00% 6.70 Mi
E0712 12:20:35.359832   15917 cache.go:225] Error downloading kic artifacts:  not yet implemented, see issue #8426
🔥  Creating podman container (CPUs=2, Memory=3072MB) ...
🐳  Preparing Kubernetes v1.33.2 on Docker 28.1.1 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
🔗  Configuring bridge CNI (Container Networking Interface) ...
🔎  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

[bugwz@iZj6cibr8kn3thfefwcyg3Z minikube]$ sudo podman inspect minikube
[
    {
        "Id": "db2b5308a1f00f4fa9bd5192286f320a0fe4ae8ca636a1a29d386505599a5d7c",
        "Created": "2025-07-12T12:21:45.17550111+08:00",
        "Path": "/usr/local/bin/entrypoint",
        "Args": [
            "/sbin/init"
...
        "Mounts": [
            {
                "Type": "volume",
                "Name": "minikube",
                "Source": "/var/lib/containers/storage/volumes/minikube/_data",
                "Destination": "/var",
                "Driver": "local",
                "Mode": "",
                "Options": [
                    "exec",
                    "nosuid",
                    "nodev",
                    "rbind"
                ],
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "bind",
                "Source": "/lib/modules",
                "Destination": "/lib/modules",
                "Driver": "",
                "Mode": "",
                "Options": [
                    "rbind"
                ],
                "RW": false,
                "Propagation": "rprivate"
            },
            {
                "Type": "bind",
                "Source": "/data01",
                "Destination": "/data01",
                "Driver": "",
                "Mode": "",
                "Options": [
                    "rbind"
                ],
                "RW": true,
                "Propagation": "rprivate"
            }
        ],
...

After:

[bugwz@iZj6cibr8kn3thfefwcyg3Z minikube]$ ./out/minikube version
minikube version: v1.36.0
commit: 14c679030368174bde9cbd24753f8c141c6e6da0

[bugwz@iZj6cibr8kn3thfefwcyg3Z minikube]# ./out/minikube start --help
...
    --mount-string='/home/bugwz:/minikube-host':
	The argument to pass the minikube mount command on start, in a semicolon-separated format.
...

[bugwz@iZj6cibr8kn3thfefwcyg3Z minikube]$ ./out/minikube start --driver="podman" --mount --mount-string="/data01:/data01;/data02:/data02:Z,rshared"
😄  minikube v1.36.0 on Centos 8.5.2111 (amd64)
❗  The minimum required version for podman is "4.9.0". your version is "3.3.1". minikube might not work. use at your own risk. To install latest version please see https://podman.io/getting-started/installation.html
✨  Using the podman driver based on user configuration

🧯  The requested memory allocation of 3072MiB does not leave room for system overhead (total system memory: 3625MiB). You may face stability issues.
💡  Suggestion: Start minikube with less memory allocated: 'minikube start --memory=3072mb'

📌  Using Podman driver with root privileges
👍  Starting "minikube" primary control-plane node in "minikube" cluster
🚜  Pulling base image v0.0.47 ...
E0712 12:30:33.731925   33550 cache.go:225] Error downloading kic artifacts:  not yet implemented, see issue #8426
🔥  Creating podman container (CPUs=2, Memory=3072MB) ...
🐳  Preparing Kubernetes v1.33.2 on Docker 28.1.1 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
🔗  Configuring bridge CNI (Container Networking Interface) ...
🔎  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

[bugwz@iZj6cibr8kn3thfefwcyg3Z minikube]$ sudo podman inspect minikube
[
    {
        "Id": "7cea00a807474ac6a111bc91ab33c9a857ca17831c1ba4df0521221bdca384b9",
        "Created": "2025-07-12T12:30:43.641329142+08:00",
        "Path": "/usr/local/bin/entrypoint",
        "Args": [
            "/sbin/init"
        ],
...
        "Mounts": [
            {
                "Type": "volume",
                "Name": "minikube",
                "Source": "/var/lib/containers/storage/volumes/minikube/_data",
                "Destination": "/var",
                "Driver": "local",
                "Mode": "",
                "Options": [
                    "exec",
                    "nosuid",
                    "nodev",
                    "rbind"
                ],
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "bind",
                "Source": "/lib/modules",
                "Destination": "/lib/modules",
                "Driver": "",
                "Mode": "",
                "Options": [
                    "rbind"
                ],
                "RW": false,
                "Propagation": "rprivate"
            },
            {
                "Type": "bind",
                "Source": "/data01",
                "Destination": "/data01",
                "Driver": "",
                "Mode": "",
                "Options": [
                    "rbind"
                ],
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "bind",
                "Source": "/data02",
                "Destination": "/data02",
                "Driver": "",
                "Mode": "",
                "Options": [
                    "rbind"
                ],
                "RW": true,
                "Propagation": "rshared"
            }
        ],
...

@medyagh
Copy link
Member

medyagh commented Jul 14, 2025

thank you @bugwz can you plz fix the lint issue ?
u can run "make lint" or look at output of https://github.com/kubernetes/minikube/actions/runs/16223086483/job/45836007332?pr=21056

Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see comments and also fix lint issues (make lint)

Name: "relative container path",
MountString: "/foo/bar:baz/bat:private",
ExpectErr: true,
Name: "relative container path",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add more unit test cases and include some test cases with semi colomon

@@ -173,7 +173,7 @@ func initMinikubeFlags() {
startCmd.Flags().Bool(embedCerts, false, "if true, will embed the certs in kubeconfig.")
startCmd.Flags().StringP(containerRuntime, "c", constants.DefaultContainerRuntime, fmt.Sprintf("The container runtime to be used. Valid options: %s (default: auto)", strings.Join(cruntime.ValidRuntimes(), ", ")))
startCmd.Flags().Bool(createMount, false, "This will start the mount daemon and automatically mount files into minikube.")
startCmd.Flags().String(mountString, constants.DefaultMountDir+":/minikube-host", "The argument to pass the minikube mount command on start.")
startCmd.Flags().String(mountString, constants.DefaultMountDir+":/minikube-host", "The argument to pass the minikube mount command on start, in a semicolon-separated format.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can add an example here for clarity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants