Skip to content

Kubevirt windows 11 install with VM and VMI

Allan Roger Reid edited this page Aug 2, 2024 · 2 revisions

https://kubevirt.io/2022/KubeVirt-installing_Microsoft_Windows_11_from_an_iso.html https://kubevirt.io/2020/KubeVirt-installing_Microsoft_Windows_from_an_iso.html https://techcommunity.microsoft.com/t5/windows-11/how-to-bypass-windows-11-system-requirements-during-installation/m-p/4060758

export TAG=$(curl -s -w %{redirect_url} https://github.com/kubevirt/containerized-data-importer/releases/latest)
export VERSION=$(echo ${TAG##*/})
kubectl create -f https://github.com/kubevirt/containerized-data-importer/releases/download/v1.59.0/cdi-operator.yaml
kubectl create -f https://github.com/kubevirt/containerized-data-importer/releases/download/$VERSION/cdi-cr.yaml

kubectl -n cdi get all

kubectl create namespace vms

kubectl port-forward -n cdi service/cdi-uploadproxy 18443:443
wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
OR
Download windows 11 ISO manually
./virtctl image-upload dv win-enterprise-2k11 --namespace=vms --size=10Gi --image-path=/Users/allanreid/Downloads/22631.2428.231001-0608.23H2_NI_RELEASE_SVC_REFRESH_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso --uploadproxy-url=https://127.0.0.1:18443  --access-mode=ReadWriteOnce --volume-mode=filesystem --insecure --force-bind

k -n vms delete pvc winhd
cat << EOF > winhd.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  namespace: vms
  name: winhd
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi
  storageClassName: directpv-min-io
EOF
k create -f winhd.yaml

k -n vms delete vm win2k11-0
cat << EOF > win2k11-0.yaml
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
  labels:
    min.io/vm: win2k11-0
  name: win2k11-0
  namespace: vms
spec:
  running: false
  template:
    metadata:
      labels:
        min.io/vm: win2k11-0
    spec:
      domain:
        cpu:
          cores: 2
        devices:
          disks:
          - cdrom:
              bus: sata
            name: cdromiso
          - disk:
              bus: virtio
            name: harddrive
          - cdrom:
              bus: sata
            name: virtiocontainerdisk
          tpm: {}
        firmware:
          bootloader:
            efi:
              secureBoot: false
          uuid: 5d307ca9-b3ef-428c-8861-06e72d69f223
        resources:
          requests:
            memory: 4G
      volumes:
      - name: cdromiso
        persistentVolumeClaim:
          claimName: win2k11-enterprise
      - name: harddrive
        persistentVolumeClaim:
          claimName: winhd
      - containerDisk:
          image: kubevirt/virtio-container-disk
        name: virtiocontainerdisk
EOF
k create -f win2k11-0.yaml

./virtctl -n vms start win2k11-0
kubectl -n vms get vm win2k11-0 -w

./virtctl -n vms vnc win2k11-0

k -n vms delete vmi win2k11-1
cat << EOF > win2k11-1.yaml
apiVersion: kubevirt.io/v1
kind: VirtualMachineInstance
metadata:
  labels:
    special: vmi-windows
    min.io/vm: win2k11-1
  name: win2k11-1
  namespace: vms
spec:
  domain:
    clock:
      timer:
        hpet:
          present: false
        hyperv: {}
        pit:
          tickPolicy: delay
        rtc:
          tickPolicy: catchup
      utc: {}
    cpu:
      cores: 2
    devices:
      disks:
      - cdrom:
          bus: sata
        name: cdromiso
      - cdrom:
          bus: sata
        name: virtiocontainerdisk
      interfaces:
      - masquerade: {}
        model: e1000
        name: default
      tpm: {}
    features:
      acpi: {}
      apic: {}
      hyperv:
        relaxed: {}
        spinlocks:
          spinlocks: 8191
        vapic: {}
      smm: {}
    firmware:
      bootloader:
        efi:
          secureBoot: true
      uuid: 5d307ca9-b3ef-428c-8861-06e72d69f223
    resources:
      requests:
        memory: 4Gi
  networks:
  - name: default
    pod: {}
  terminationGracePeriodSeconds: 0
  volumes:
  - name: pvcdisk
    persistentVolumeClaim:
      claimName: winhd
  - name: cdromiso
    persistentVolumeClaim:
      claimName: win2k11-enterprise
  - containerDisk:
      image: kubevirt/virtio-container-disk
    name: virtiocontainerdisk
EOF
k create -f win2k11-1.yaml

./virtctl -n vms start win2k11-1
kubectl -n vms get vm win2k11-1 -w

./virtctl -n vms vnc win2k11-1
Clone this wiki locally