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 start a VirtualMachineInstance on Mac Apple Silicon. #11917

Open
valebes opened this issue May 15, 2024 · 3 comments
Open

Unable to start a VirtualMachineInstance on Mac Apple Silicon. #11917

valebes opened this issue May 15, 2024 · 3 comments
Labels

Comments

@valebes
Copy link

valebes commented May 15, 2024

What happened:
It is impossible to run a VM on a MacBook Pro M1 Pro (Apple Silicon/aarch64).
When doing a kubectl get vmi -o yaml I get the following error:

- lastProbeTime: null lastTransitionTime: "2024-05-14T15:29:49Z" message: 'server error. command SyncVMI failed: "LibvirtError(Code=67, Domain=10, Message=''unsupported configuration: CPU mode ''host-passthrough'' for aarch64 qemu domain on aarch64 host is not supported by hypervisor'')"' reason: Synchronizing with the Domain failed.

What you expected to happen:
The VM should start properly.

How to reproduce it (as minimally and precisely as possible):
As suggested in #10055, I enabled SW Emulation.
Moreover, I'm trying to run an ARM64 vm.
I used the following config for the virtual machine instance:

apiVersion: kubevirt.io/v1
kind: VirtualMachineInstance
metadata:
  name: testvm
spec:
  domain:
    machine:
      type: virt
    cpu:
      model: host-passthrough
    devices:
      disks:
        - disk:
            bus: virtio
          name: harddisk
      interfaces:
      - name: default
        masquerade: {}
    resources:
      requests:
        memory: 64M
  networks:
  - name: default
    pod: {}
  volumes:
    - name: harddisk
      persistentVolumeClaim:
        claimName: arm-dv

I found one with the same problem here.

Additional context:
No other things to report.

Environment:

  • KubeVirt version (use virtctl version): 1.2.0
  • Kubernetes version (use kubectl version): v1.29.2
  • VM or VMI specifications: N/A
  • Cloud provider or hardware configuration: MacBook Pro M1 Pro
  • OS (e.g. from /etc/os-release): Sonoma 14.5 (MacOS)
  • Kernel (e.g. uname -a): Darwin
  • Install tools: brew
  • Others: N/A
@victortoso
Copy link
Member

Hi, can I ask you first what is the goal on running k8s + kubevirt on macbook?

The main problem I think, its the fact that KubeVirt uses kvm and that's not supported on macbook. Yes, you can enable software emulation but it will be very slow, hence my first question to see if this is really what you want or not.

wrt the error, it comes from libvirt. As per the user-guide, host-passthrough is the right cpu model, so not sure what's going on.

@valebes
Copy link
Author

valebes commented May 16, 2024

Hi @victortoso, first of all, thanks for your help.

I'm doing some experiment with some small vm image and kubernetes. Anyway, on mac i can run the same image directly with qemu using -cpu max as cpu model, while using -cpu host doesn't work because it says that need kvm or hvf (same thing said in https://libvirt.org/formatdomain.html#cpu-model-and-topology).

When I try to specify a setting other than host-passthrough in the VirtualMachineInstance configuration file, the resource remains in "scheduling state" with the following error

      lastTransitionTime: "2024-05-16T07:34:14Z"
      message: '0/1 nodes are available: 1 node(s) didn''t match Pod''s node affinity/selector.
        preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.'
      reason: Unschedulable

@daviderestivo
Copy link

daviderestivo commented Jun 1, 2024

I have exactly the same issue when I try to run Kubevirt on an M1 MacBook:

Message='unsupported configuration: CPU mode 'host-passthrough' for aarch64 qemu domain on aarch64 host is not supported by hypervisor')"

Relevant logs:

$ cat testvm.yaml
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
  name: testvm
spec:
  running: false
  template:
    metadata:
      labels:
        kubevirt.io/size: small
        kubevirt.io/domain: testvm
    spec:
      domain:
        cpu:
          model: host-passthrough
        devices:
          disks:
            - name: containerdisk
              disk:
                bus: virtio
            - name: cloudinitdisk
              disk:
                bus: virtio
          interfaces:
          - name: default
            masquerade: {}
        resources:
          requests:
            memory: 64M
      networks:
      - name: default
        pod: {}
      volumes:
        - name: containerdisk
          containerDisk:
            image: quay.io/kubevirt/cirros-container-disk-demo
        - name: cloudinitdisk
          cloudInitNoCloud:
            userDataBase64: SGkuXG4=
$ kubectl describe vm testvm
Name:         testvm
Namespace:    default
Labels:       <none>
Annotations:  kubevirt.io/latest-observed-api-version: v1
              kubevirt.io/storage-observed-api-version: v1
API Version:  kubevirt.io/v1
Kind:         VirtualMachine
Metadata:
  Creation Timestamp:  2024-06-01T13:34:57Z
  Finalizers:
    kubevirt.io/virtualMachineControllerFinalize
  Generation:        2
  Resource Version:  3483
  UID:               0fa843e5-4cf3-4665-9597-735dcbb023b3
Spec:
  Running:  true
  Template:
    Metadata:
      Creation Timestamp:  <nil>
      Labels:
        kubevirt.io/domain:  testvm
        kubevirt.io/size:    small
    Spec:
      Architecture:  arm64
      Domain:
        Cpu:
          Model:  host-passthrough
        Devices:
          Disks:
            Disk:
              Bus:  virtio
            Name:   containerdisk
            Disk:
              Bus:  virtio
            Name:   cloudinitdisk
          Interfaces:
            Masquerade:
            Name:  default
        Machine:
          Type:  virt
        Resources:
          Requests:
            Memory:  64M
      Networks:
        Name:  default
        Pod:
      Volumes:
        Container Disk:
          Image:  quay.io/kubevirt/cirros-container-disk-demo
        Name:     containerdisk
        Cloud Init No Cloud:
          userDataBase64:  SGkuXG4=
        Name:              cloudinitdisk
Status:
  Conditions:
    Last Probe Time:       2024-06-01T13:35:09Z
    Last Transition Time:  2024-06-01T13:35:09Z
    Message:               Guest VM is not reported as running
    Reason:                GuestNotRunning
    Status:                False
    Type:                  Ready
    Last Probe Time:       <nil>
    Last Transition Time:  <nil>
    Status:                True
    Type:                  LiveMigratable
    Last Probe Time:       <nil>
    Last Transition Time:  2024-06-01T13:35:15Z
    Message:               server error. command SyncVMI failed: "LibvirtError(Code=67, Domain=10, Message='unsupported configuration: CPU mode 'host-passthrough' for aarch64 qemu domain on aarch64 host is not supported by hypervisor')"
    Reason:                Synchronizing with the Domain failed.
    Status:                False
    Type:                  Synchronized
  Created:                 true
  Desired Generation:      2
  Observed Generation:     2
  Printable Status:        Starting
  Run Strategy:            Always
  Volume Snapshot Statuses:
    Enabled:  false
    Name:     containerdisk
    Reason:   Snapshot is not supported for this volumeSource type [containerdisk]
    Enabled:  false
    Name:     cloudinitdisk
    Reason:   Snapshot is not supported for this volumeSource type [cloudinitdisk]
Events:
  Type    Reason            Age    From                       Message
  ----    ------            ----   ----                       -------
  Normal  SuccessfulCreate  2m18s  virtualmachine-controller  Started the virtual machine by creating the new virtual machine instance testvm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants