我无法使用 Kubevirt 从 .qcow2 映像启动 VM。该映像在 DataVolume 模板中指定。这是我的配置:

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:
        devices:
          disks:
            - name: datavolumedisk1
              disk:
                bus: virtio
        resources:
          requests:
            memory: 1G
      volumes:
        - dataVolume:
            name: rocky9-dv
          name: datavolumedisk1
  dataVolumeTemplates:
    - metadata:
        name: rocky9-dv
      spec:
        pvc:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 20Gi
        source: #This is the source where the ISO file resides
          http:
            url: http://localhost:8000/kvm1.qcow2

它已成功应用。使用 启动后virtctl start testvm -n kubevirt,我看到以下状态:

kubectl describe vm testvm -n kubevirt
...
Status:
  Conditions:
    Last Probe Time:       2024-09-16T20:06:32Z
    Last Transition Time:  2024-09-16T20:06:32Z
    Message:               VMI does not exist
    Reason:                VMINotExists
    Status:                False
    Type:                  Ready
  Printable Status:        DataVolumeError
...

http://localhost:8000/kvm1.qcow2由同一台机器上的 Web 服务器提供服务。错误发生在向服务器发出请求之前,因为我没有看到向服务器发出的请求。

我看到了该 Pod 的状态:

kubectl get pod -n kubevirt
NAME                               READY   STATUS             RESTARTS        AGE
importer-rocky9-dv                 0/1     CrashLoopBackOff   9 (2m29s ago)   23m

0