Skip to content

iso: Enable VirtioFS for x86_64 and aarch64 #21147

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

Merged
merged 2 commits into from
Jul 28, 2025

Conversation

nirs
Copy link
Contributor

@nirs nirs commented Jul 25, 2025

The Virtio Filesystem[1] allows guests to mount file systems from the host.

Testing with krunkit show 10 times faster read throughput:

minikube krunkit - 9p:

$ time cp /mnt/models/mistral-7b-instruct-v0.2.Q4_K_M.gguf model

real  0m34.330s
user  0m0.019s
sys   0m1.959s

podman krunkit - virtiofs:

$ time cp /Users/nir/Downloads/models/mistral-7b-instruct-v0.2.Q4_K_M.gguf model

real  0m3.245s
user  0m0.006s
sys   0m1.035s

We must have virtiofs for playing with AI workload in krunkit. It can be nice improvment for vfkti and qemu, and should be available in ohter hypervisors.

Status

Not tested yet, waiting for the iso build.

[1] https://virtio-fs.gitlab.io/index.html

The Virtio Filesystem[1] allows guests to mount file systems from the
host.

Testing with krunkit show 10 times faster read throughput:

minikube krunkit - 9p:

    $ time cp /mnt/models/mistral-7b-instruct-v0.2.Q4_K_M.gguf model

    real	0m34.330s
    user	0m0.019s
    sys     0m1.959s

podman krunkit - virtiofs:

    $ time cp /Users/nir/Downloads/models/mistral-7b-instruct-v0.2.Q4_K_M.gguf model

    real	0m3.245s
    user	0m0.006s
    sys     0m1.035s

We must have virtiofs for playing with AI workload in krunkit. It can be
nice improvment for vfkti and qemu, and should be available in ohter
hypervisors.

[1] https://virtio-fs.gitlab.io/index.html
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 25, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: nirs
Once this PR has been reviewed and has the lgtm label, please assign spowelljr 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 k8s-ci-robot requested a review from medyagh July 25, 2025 23:45
@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 25, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @nirs. 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.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 25, 2025
@nirs
Copy link
Contributor Author

nirs commented Jul 25, 2025

ok-to-build-iso

nirs added a commit to nirs/minikube that referenced this pull request Jul 25, 2025
Add --virtio-fs flag for specifying one or more shared directories
separated by comma. The shared directories are be mounted in the guest
using virtio-fs.

Testing with krunkit shows that virtio-fs mount is 10 times faster
compared with 9p mount.

Usage:

   --virtio-fs HOST_PATH:MOUNT_TAG[,HOST_PATH:MOUNT_TAG,...]

Example:

    minikube start --vrtio-fs /Users/joe/models:my-models

Using a new flag since none of the mount options matches virtio-fs
usage, and it will be too confusing to use using mount options.

In krunkit and vfkit, every virtio-fs shared directory will be added as:

    --device virtio-fs,sharedDir=/host-path,mountTag=mount-tag

In the guest the shared directory will be mounted using:

    sudo mount -t virtiofs my-models /mnt/my-models

This change only adds the options and configure vfkit and krunkit. The
next step is connecting to the guest and mounting the shared
directories.

More work is needed to add VirtioFS to qemu. I'm starting with fkit and
krunkit since they have identical interface (krunkit was designed as
drop-in replacement for vfkit).

Issues:
- We don't have virtiofs in the kernel yet, requires kubernetes#21147
nirs added a commit to nirs/minikube that referenced this pull request Jul 26, 2025
Add --virtio-fs flag for specifying one or more shared directories
separated by comma. The shared directories are be mounted in the guest
using virtio-fs.

Testing with krunkit shows that virtio-fs mount is 10 times faster
compared with 9p mount.

Usage:

   --virtio-fs HOST_PATH:MOUNT_TAG[,HOST_PATH:MOUNT_TAG,...]

Example:

    minikube start --vrtio-fs /Users/joe/models:my-models

Using a new flag since none of the mount options matches virtio-fs
usage, and it will be too confusing to use using mount options.

In krunkit and vfkit, every virtio-fs shared directory will be added as:

    --device virtio-fs,sharedDir=/host-path,mountTag=mount-tag

In the guest the shared directory will be mounted using:

    sudo mount -t virtiofs my-models /mnt/my-models

This change only adds the options and configure vfkit and krunkit. The
next step is connecting to the guest and mounting the shared
directories.

More work is needed to add VirtioFS to qemu. I'm starting with fkit and
krunkit since they have identical interface (krunkit was designed as
drop-in replacement for vfkit).

Issues:
- We don't have virtiofs in the kernel yet, requires kubernetes#21147
@minikube-bot
Copy link
Collaborator

Hi @nirs, we have updated your PR with the reference to newly built ISO. Pull the changes locally if you want to test with them or update your PR further.

@nirs
Copy link
Contributor Author

nirs commented Jul 26, 2025

@medyagh @ComradeProgrammer can you add /ok-to-test and approve the workflows?

@medyagh
Copy link
Member

medyagh commented Jul 26, 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 26, 2025
@medyagh
Copy link
Member

medyagh commented Jul 26, 2025

wow thats signifact improvement, how about we make that default for the drivers/platofrms that support it?

@nirs
Copy link
Contributor Author

nirs commented Jul 26, 2025

wow thats signifact improvement, how about we make that default for the drivers/platofrms that support it?

It is not compatible with mount options and the mount command:

  • minikube mount create mounts dynamically, but virtuous must be specified when the guest starts.
  • mount options are global, but we want mount options per mount.
  • mount options are not compatible or not relevant:
    • --mount-string: expects host-path:guest-path - do we want to provide this or only support mount under /mnt?
    • --mount=false: not relevant
    • --mount-9p-version='9p2000.L': not relevant
    • --mount-gid='docker': do we want to support aid on the mount?
    • --mount-ip='': not relevant
    • --mount-msize=262144: not relevant
    • --mount-options=[]: we can let the user specify the guest mount command options, but this is to low level.
    • --mount-port=0: not relevant
    • --mount-uid='docker': do we want to support uid on the guest mount?

So we can use the Driver Mount feature, like hyperkit --nfs-share.

@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

┌────────────────┬──────────┬────────────────────────┐
│    COMMAND     │ MINIKUBE │ MINIKUBE  ( PR 21147 ) │
├────────────────┼──────────┼────────────────────────┤
│ minikube start │ 49.9s    │ 50.5s                  │
│ enable ingress │ 14.6s    │ 14.8s                  │
└────────────────┴──────────┴────────────────────────┘

Times for minikube start: 47.8s 48.8s 50.1s 50.9s 51.7s
Times for minikube (PR 21147) start: 49.1s 51.9s 51.5s 51.0s 48.9s

Times for minikube ingress: 14.5s 15.0s 15.0s 14.0s 14.5s
Times for minikube (PR 21147) ingress: 14.5s 14.9s 14.5s 15.0s 15.0s

docker driver with docker runtime

┌────────────────┬──────────┬────────────────────────┐
│    COMMAND     │ MINIKUBE │ MINIKUBE  ( PR 21147 ) │
├────────────────┼──────────┼────────────────────────┤
│ minikube start │ 24.8s    │ 24.2s                  │
│ enable ingress │ 12.7s    │ 12.7s                  │
└────────────────┴──────────┴────────────────────────┘

Times for minikube (PR 21147) start: 23.4s 24.8s 23.0s 23.1s 26.6s
Times for minikube start: 22.2s 25.8s 26.7s 23.8s 25.7s

Times for minikube ingress: 12.3s 12.3s 12.8s 12.8s 13.3s
Times for minikube (PR 21147) ingress: 12.8s 12.3s 12.3s 13.3s 12.8s

docker driver with containerd runtime

┌────────────────┬──────────┬────────────────────────┐
│    COMMAND     │ MINIKUBE │ MINIKUBE  ( PR 21147 ) │
├────────────────┼──────────┼────────────────────────┤
│ minikube start │ 22.8s    │ 23.7s                  │
│ enable ingress │ 29.4s    │ 32.4s                  │
└────────────────┴──────────┴────────────────────────┘

Times for minikube ingress: 22.8s 39.3s 22.8s 39.3s 22.8s
Times for minikube (PR 21147) ingress: 38.8s 22.8s 38.8s 22.8s 38.8s

Times for minikube start: 21.7s 21.6s 24.4s 22.3s 23.9s
Times for minikube (PR 21147) start: 25.0s 21.6s 24.6s 22.1s 25.1s

@nirs
Copy link
Contributor Author

nirs commented Jul 26, 2025

@medyagh @ComradeProgrammer can you re-run the qemu smoke test?

@medyagh medyagh merged commit e6347e0 into kubernetes:master Jul 28, 2025
34 of 43 checks passed
elasticdotventures pushed a commit to elasticdotventures/minikube that referenced this pull request Aug 6, 2025
* iso: Enable VirtioFS for x86_64 and aarch64

The Virtio Filesystem[1] allows guests to mount file systems from the
host.

Testing with krunkit show 10 times faster read throughput:

minikube krunkit - 9p:

    $ time cp /mnt/models/mistral-7b-instruct-v0.2.Q4_K_M.gguf model

    real	0m34.330s
    user	0m0.019s
    sys     0m1.959s

podman krunkit - virtiofs:

    $ time cp /Users/nir/Downloads/models/mistral-7b-instruct-v0.2.Q4_K_M.gguf model

    real	0m3.245s
    user	0m0.006s
    sys     0m1.035s

We must have virtiofs for playing with AI workload in krunkit. It can be
nice improvment for vfkti and qemu, and should be available in ohter
hypervisors.

[1] https://virtio-fs.gitlab.io/index.html

* Updating ISO to v1.36.0-1753487480-21147

---------

Co-authored-by: minikube-bot <minikube-bot@google.com>
pavansaikrishna78 pushed a commit to pavansaikrishna78/minikube that referenced this pull request Aug 11, 2025
* iso: Enable VirtioFS for x86_64 and aarch64

The Virtio Filesystem[1] allows guests to mount file systems from the
host.

Testing with krunkit show 10 times faster read throughput:

minikube krunkit - 9p:

    $ time cp /mnt/models/mistral-7b-instruct-v0.2.Q4_K_M.gguf model

    real	0m34.330s
    user	0m0.019s
    sys     0m1.959s

podman krunkit - virtiofs:

    $ time cp /Users/nir/Downloads/models/mistral-7b-instruct-v0.2.Q4_K_M.gguf model

    real	0m3.245s
    user	0m0.006s
    sys     0m1.035s

We must have virtiofs for playing with AI workload in krunkit. It can be
nice improvment for vfkti and qemu, and should be available in ohter
hypervisors.

[1] https://virtio-fs.gitlab.io/index.html

* Updating ISO to v1.36.0-1753487480-21147

---------

Co-authored-by: minikube-bot <minikube-bot@google.com>
pavansaikrishna78 pushed a commit to pavansaikrishna78/minikube that referenced this pull request Aug 18, 2025
* iso: Enable VirtioFS for x86_64 and aarch64

The Virtio Filesystem[1] allows guests to mount file systems from the
host.

Testing with krunkit show 10 times faster read throughput:

minikube krunkit - 9p:

    $ time cp /mnt/models/mistral-7b-instruct-v0.2.Q4_K_M.gguf model

    real	0m34.330s
    user	0m0.019s
    sys     0m1.959s

podman krunkit - virtiofs:

    $ time cp /Users/nir/Downloads/models/mistral-7b-instruct-v0.2.Q4_K_M.gguf model

    real	0m3.245s
    user	0m0.006s
    sys     0m1.035s

We must have virtiofs for playing with AI workload in krunkit. It can be
nice improvment for vfkti and qemu, and should be available in ohter
hypervisors.

[1] https://virtio-fs.gitlab.io/index.html

* Updating ISO to v1.36.0-1753487480-21147

---------

Co-authored-by: minikube-bot <minikube-bot@google.com>
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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants