Commit Graph

179 Commits (master)

Author SHA1 Message Date
Nir Soffer 56975bc752
Add krunkit driver supporting GPU acceleration on macOS (#20826)
* krunkit: Add krunkit driver

krunkit is a tool to launch configurable virtual machines using the
libkrun platform, optimized for GPU accelerated virtual machines and AI
workloads on Apple silicon.

It is mostly compatible with vfkit; the driver is a simplified copy of
the vfkit driver. Unlike vfkit, krunkit is available only on Apple
silicon.

Changes compared to vfkit driver:
- krunkit requires unix socket for networking, so we must use
  vment-helper.
- krunkit does not support HardStop, so we kill it using SIGKILL.
- We must enable vmnet offloading, required for krunkit.
- The code was simplified since vmnet-helper is always used
- Code was cleaned up to use .ResolveStorePath()
- Unused Upgrade() function was removed
- Types and functions that should not be public made private

We require krunkit 0.2.2, supporting --restul-uri=unix://.

* reason: Make vment-helper error driver agnostic

Previously it was used only for vfkit, so we suggested to fallback to
the `nat` network. This advice is not relevant to krunkit or to qemu
(which can also use vmnet-helper).

Change the error to recommend installing vment-helper. We need to think
how we can recommend other networks for vfkit and qemu. Another solution
is to create error for every driver+network combination but this seems
hard to manage.

* hack: Add krunkit integration test

This is the same way that we test vfkit. This test is not running in the
CI.

Issues:
- Need to install and configure vment-helper (requires root).

* site: Add krunkit driver documentation
2025-07-21 12:59:28 -07:00
Nir Soffer b973335449
docs: Update vment-helper installation (#21085)
vment-helper 0.6.0 simplified the installation by removing the version
from the tarball.
2025-07-17 16:01:17 -07:00
Nir Soffer b66888d972
vfkit: Use EFI booloader (#20833)
* vfkit: Log serial console to file

To make debugging easier, add virtio-serial device logging serial
console to file:

    ~/.minikube/machines/NAME/serial.log

To enable logging, we need to enable the console in the kernel command
line, since we still use direct kernel boot.

Example log:

    % cat /Users/nir/.minikube/machines/vfkit/vfkig.log
    [    0.896094] cacheinfo: Unable to detect cache hierarchy for CPU 0
    [    0.897186] loop: module loaded
    [    0.897670] virtio_blk virtio2: [vda] 840488 512-byte logical blocks (430 MB/410 MiB)
    [    0.897733] vda: detected capacity change from 0 to 430329856
    [    0.898460] virtio_blk virtio3: [vdb] 40960000 512-byte logical blocks (21.0 GB/19.5 GiB)
    [    0.898533] vdb: detected capacity change from 0 to 20971520000
    ...
    [    1.794714] systemd[1]: Detected virtualization vm-other.
    [    1.794752] systemd[1]: Detected architecture arm64.

    Welcome to Buildroot 2025.02!

    [    1.794944] systemd[1]: Hostname set to <minikube>.
    [    1.795011] systemd[1]: Initializing machine ID from random generator.
    ...
    [  OK  ] Started Container Runtime Interface for OCI (CRI-O).
    [  OK  ] Reached target Multi-User System.

    Welcome to minikube
    vfkit login: [    6.681578] systemd-ssh-generator[630]: Binding SSH to AF_UNIX socket /run/ssh-unix-local/socket.

* vfkit: Use EFI bootloader

With the fixed iso, we can simplify the driver using the EFI bootloader
option[1] instead of the legacy and deprecated --kernel, --kernel-cmdline,
and --initrd options[2].

Example run:

    % minikube start -p vfkit --driver vfkit --container-runtime containerd --network vmnet-shared
    😄  [vfkit] minikube v1.36.0 on Darwin 15.5 (arm64)
      Using the vfkit driver based on user configuration
    👍  Starting "vfkit" primary control-plane node in "vfkit" cluster
    🔥  Creating vfkit VM (CPUs=2, Memory=6000MB, Disk=20000MB) ...
    📦  Preparing Kubernetes v1.33.1 on containerd 1.7.23 ...
        ▪ 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: default-storageclass, storage-provisioner
    🏄  Done! kubectl is now configured to use "vfkit" cluster and "default" namespace by default

Comparing direct kernel boot and --bootloader efi shows that it is little bit faster and boot time is more consistent.

    % hyperfine -r 10 -C "minikube delete" \
        "vfkit-efi/out/minikube start --driver vfkit --network vmnet-shared --container-runtime containerd --no-kubernetes" \
        "vfkit-direct/out/minikube start --driver vfkit --network vmnet-shared --container-runtime containerd --no-kubernetes"
    Benchmark 1: vfkit-efi/out/minikube start --driver vfkit --network vmnet-shared --container-runtime containerd --no-kubernetes
      Time (mean ± σ):     10.205 s ±  0.656 s    [User: 0.381 s, System: 0.266 s]
      Range (min … max):    9.106 s … 11.254 s    10 runs

    Benchmark 2: vfkit-direct/out/minikube start --driver vfkit --network vmnet-shared --container-runtime containerd --no-kubernetes
      Time (mean ± σ):     10.933 s ±  1.616 s    [User: 0.402 s, System: 0.406 s]
      Range (min … max):    9.155 s … 14.168 s    10 runs

    Summary
      vfkit-efi/out/minikube start --driver vfkit --network vmnet-shared --container-runtime containerd --no-kubernetes ran
        1.07 ± 0.17 times faster than vfkit-direct/out/minikube start --driver vfkit --network vmnet-shared --container-runtime containerd --no-kubernetes

[1] https://github.com/crc-org/vfkit/blob/main/doc/usage.md#efi-bootloader
[2] https://github.com/crc-org/vfkit/blob/main/doc/usage.md#deprecated-options

* docs: Update vfkit driver documentation

- Separate vfkit requirements and vmnet-shared requirements
- Update minimal macOS version required for --bootloader efi
- Simplify vfkit upgrade, it is available in brew now
2025-06-10 10:21:10 -07:00
Nir Soffer 56ed2662b0
vfkit: Minor docs, test, and help fixes (#20815)
* vfkit: Fix help text for --extra-disks

vfkit can use extra disks but we forgot to mention it in the help text.

* vfkit: Remove stale tap

vfkit in cfergeau/crc will no longer be updated now that it’s in the main repo.

* vfkit: Fix status in index

The vfkit driver is preferred now.
2025-05-21 20:30:26 -07:00
Anthony Holloman b0a0695082
Update qemu.md docs for homebrew/services decommission (#20685)
`brew tap homebrew/services` is now unnecessary.

Previous Tap:
https://github.com/Homebrew/homebrew-services

New Tap:
https://github.com/Homebrew/brew
2025-05-15 11:13:29 -07:00
Nir Soffer 55b88a6763
Shared network for vfkit driver using vmnet-helper (#20501)
* vfkit: Remove temporary variable

Remove temporary and unneeded mac variable. It is easier to follow the
code when we use d.MACAddress.

* vfkit: Promote state change to INFO level

System state changes should be more visible to make debugging easier.

* vmnet: Add vmnet package

The package manages the vmnet-helper[1] child process, providing
connection to the vmnet network without running the guest as root.

We will use vmnet-helper for the vfkit driver, which does not have a way
to use shared network, when guests can access other guest in the
network.  We can use it later with the qemu driver as alternative to
socket_vmnet.

[1] https://github.com/nirs/vmnet-helper

* vfkit: add vmnet-shared network

Add new network option for vfkit "vmnet-shared", connecting vfkit to the
vmnet shared network. Clusters using this network can access other
clusters in the same network, similar to socket_vmnet with QEMU driver.

If network is not specified, we default to the "nat" network, keeping
the previous behavior. If network is "vmnet-shared", the vfkit driver
manages 2 processes: vfkit and vmnet-helper.

Like vfkit, vmnet-helper is started in the background, in a new process
group, so it not terminated if the minikube process group is terminate.

Since vmnet-helper requires root to start the vmnet interface, we start
it with sudo, creating 2 child processes. vmnet-helper drops privileges
immediately after starting the vmnet interface, and run as the user and
group running minikube.

Stopping the cluster will stop sudo, which will stop the vmnet-helper
process. Deleting the cluster kill both sudo and vmnet-helper by killing
the process group.

This change is not complete, but it is good enough to play with the new
shared network.

Example usage:

1. Install vmnet-helper:
   https://github.com/nirs/vmnet-helper?tab=readme-ov-file#installation

2. Setup vmnet-helper sudoers rule:
   https://github.com/nirs/vmnet-helper?tab=readme-ov-file#granting-permission-to-run-vmnet-helper

3. Start 2 clusters with vmnet-shared network:

    % minikube start -p c1 --driver vfkit --network vmnet-shared
    ...

    % minikube start -p c2 --driver vfkit --network vmnet-shared
    ...

    % minikube ip -p c1
    192.168.105.18

    % minikube ip -p c2
    192.168.105.19

4. Both cluster can access the other cluster:

    % minikube -p c1 ssh -- ping -c 3 192.168.105.19
    PING 192.168.105.19 (192.168.105.19): 56 data bytes
    64 bytes from 192.168.105.19: seq=0 ttl=64 time=0.621 ms
    64 bytes from 192.168.105.19: seq=1 ttl=64 time=0.989 ms
    64 bytes from 192.168.105.19: seq=2 ttl=64 time=0.490 ms

    --- 192.168.105.19 ping statistics ---
    3 packets transmitted, 3 packets received, 0% packet loss
    round-trip min/avg/max = 0.490/0.700/0.989 ms

    % minikube -p c2 ssh -- ping -c 3 192.168.105.18
    PING 192.168.105.18 (192.168.105.18): 56 data bytes
    64 bytes from 192.168.105.18: seq=0 ttl=64 time=0.289 ms
    64 bytes from 192.168.105.18: seq=1 ttl=64 time=0.798 ms
    64 bytes from 192.168.105.18: seq=2 ttl=64 time=0.993 ms

    --- 192.168.105.18 ping statistics ---
    3 packets transmitted, 3 packets received, 0% packet loss
    round-trip min/avg/max = 0.289/0.693/0.993 ms

* reason: Remove trailing whitepsace

Trailing whitespace is removed by some editors or displayed as a
warning. Clean up to make it easy to make maintain this file.

* start: Validate vfkit --network option

The vfkit driver supports now `nat` and `vmnet-shared` network options.
The `nat` option provides the best performance and is always available,
so it is the default network option. The `vmnet-shared` option provides
access between machines with lower performance compared to `nat`.

If `vment-shared` option is selected, we verify that vmnet-helper is
available. The check ensure that vmnet-helper is installed and sudoers
configuration allows the current user to run vment-helper without a
password.

If validating vment-helper failed, we return a new NotFoundVmnetHelper
reason pointing to vment-helper installation docs or recommending to use
`nat`. This is based on how we treat missing socket_vmnet for QEMU
driver.

* site: Document vfkit network options
2025-05-01 13:26:48 -04:00
Bingtan Lu 1143b528bf
site: add step manage-docker-as-a-non-root-user in the requirements of docker driver (#19925)
Signed-off-by: lubingtan <bingtanlu@gmail.com>
2024-11-07 09:51:48 -08:00
Anders Björklund 5295883f4c
Add new macOS vfkit driver, like hyperkit and qemu (#19423)
* Add new macOS vfkit driver, like hyperkit and qemu

It uses the new Virtualization.framework from macOS 11,
instead of the older Hypervisor.framework (hvf) in QEMU.

* Start vfkit in a new process group

* vfkit: Add firewall workaround from minikube

* vfkit: Add HostIP implementation for gateway

* vfkit: Add driver to extra-disks supported

* Add documentation for vfkit driver

* vfkit: Add usual integration tests

* Update site/content/en/docs/drivers/vfkit.md

Co-authored-by: Steven Powell <44844360+spowelljr@users.noreply.github.com>

---------

Co-authored-by: Nir Soffer <nsoffer@redhat.com>
Co-authored-by: Medya Ghazizadeh <medyagh@users.noreply.github.com>
Co-authored-by: Steven Powell <44844360+spowelljr@users.noreply.github.com>
2024-09-03 09:54:03 -07:00
Benjamin P. Jung 6befdc5e0c
Fix typo: s/Virtulization/Virtualization/g 2024-07-19 14:15:53 +02:00
skoenig 1f73c6f0a0 doc: VirtualBox driver NIC type alternative for performance enhancement 2024-03-23 08:28:21 +01:00
Timothée Ravier 9c41c6536f treewide: Replace 'egrep' with 'grep -E'
Fixes the following warning:
```
egrep: warning: egrep is obsolescent; using grep -E
```
2024-01-14 19:58:57 +01:00
Anders F Björklund c3307ef0ef Add link to podman for macos and windows
Assuming Podman Desktop (CoreOS) is used

On Windows it will run in WSL or Hyper-V
2023-11-29 20:44:06 +01:00
Akihiro Suda 4c2180ab68
rootless: support `--container-runtime=docker`
This allows running Kubernetes with (CRI-)Dockerd in Rootless Docker:
```
minikube start --rootless --driver=docker --container-runtime=docker
```

It is still recommended to use `--container-runtime=containerd`.

Fix issue 17322

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-10-30 08:28:40 +09:00
Steven Powell 3dbf625e82 site: Update fix for dhcpd_leases issue 2023-06-22 10:17:17 -07:00
Anders F Björklund 0659dc868f Always use cni unless running with dockershim
Since cri-dockerd 0.25, it now defaults to cni.

So when using cri (not dockershim), use cni too.
2023-06-13 20:33:26 -07:00
himalayanZephyr 12f7a30b21
Update docker url in README 2023-05-18 15:55:34 +01:00
Steven Powell a76c80b5b7 site: improve none docs 2023-05-08 16:20:19 -07:00
Steven Powell c61051ea67 add iptables and conntrack location to PATH 2023-05-01 11:15:48 -07:00
Steven Powell fa9388fc9d remove sudo -E from none driver 2023-04-28 14:58:25 -07:00
Steven Powell bf4006e1aa site: add containernetworking-plugins to none driver docs 2023-04-25 14:03:39 -07:00
Juan Martín Loyola d1297d3915
Fix link to GitHub open issues label for drivers 2023-04-05 15:44:08 -03:00
Anders F Björklund 8e56b813d7 Don't suggest building cri-dockerd from source
Most people want to use the pre-built binaries of cri-dockerd,
rather than installing go and building it from the source code.

So don't link to the #build-and-install, but to the Releases.
Once it has real documentation URL, that could be used instead.
2023-04-02 22:17:28 +02:00
Steven Powell c417258f9c change user network to builtin 2023-02-09 09:48:43 -08:00
Steven Powell 7964b709ab site: improve QEMU documentation 2023-02-06 11:31:06 -08:00
Steven Powell 649b8ef5b1 remove experimental markings from QEMU driver 2022-12-28 08:42:01 -08:00
Steven Powell e3359ef909 site: Docker Desktop is now supported 2022-12-12 16:19:07 -08:00
Steven Powell 932b8f351f
Merge pull request #15299 from csantanapr/patch-2
Fixed typo uninstll on qemu workaround for /var/db/dhcpd_leases errors
2022-11-07 05:29:42 -08:00
imjoseangel 23c9a00630
Fix typo and titles for better readability 2022-11-06 00:37:03 +01:00
Carlos Santana e5a1d5c59c
make uninstall already do the sudo rm /var/run/socket_vmnet 2022-11-05 12:11:56 -04:00
Carlos Santana 74b9a47121
Typo on qemu workaround for /var/db/dhcpd_leases errors 2022-11-05 12:09:07 -04:00
Steven Powell bb07f185fa add dhcpd_leases issue to docs 2022-11-01 15:05:41 -07:00
Steven Powell 5d8512f4af update user network information
Co-authored-by: Akihiro Suda <suda.kyoto@gmail.com>
2022-10-03 15:17:29 -07:00
Steven Powell 6d4f255ea6 make network options tabbed 2022-10-03 15:17:27 -07:00
Steven Powell 47b5cfae27 add qemu networking docs 2022-10-03 15:15:45 -07:00
Steven Powell 76187a3354 update format 2022-09-30 13:19:34 -07:00
Steven Powell d6c293d76e add known issue to qemu documentation 2022-09-29 15:51:35 -07:00
klaases e9698c94a8 trim `minikube delete` suggestion 2022-09-09 15:00:43 -07:00
klaases 8bfc23632c prefer MacPorts 2022-09-08 16:59:30 -07:00
klaases 3493e50dc5
Merge branch 'master' into qemudoc2 2022-09-08 14:59:58 -07:00
Steven Powell 39640dcb8e
Merge pull request #14762 from klaases/qemudoc1
Document qemu start and default commands
2022-09-08 09:11:39 -07:00
klaases 2c72c9e99c improve grammar 2022-08-31 15:54:01 -07:00
klaases c3cecc85ba Docker Desktop unsupported 2022-08-31 15:46:34 -07:00
klaases f7f69be622 suggest purge instead 2022-08-31 14:20:11 -07:00
shaunmayo ec00c33b89
Update podman_usage.inc 2022-08-21 14:16:52 +12:00
klaases db08552f10 drop reference 2022-08-12 16:11:28 -07:00
klaases 150b506a01 update url 2022-08-12 16:08:00 -07:00
klaases 2e4c616b89 add qemu2 redirect 2022-08-12 16:01:30 -07:00
klaases 8ed0cb7124 fix grammar nit 2022-08-09 14:14:28 -07:00
klaases 0972837f48 Add Macports installation documentation 2022-08-09 14:12:55 -07:00
klaases 5569f03738 remove default driver documentation 2022-08-09 14:01:09 -07:00