Add ClusterRoleBinding to YAML declaration Remove annotation Add EOF Patchset 2 update (remove ClusterRoleBinding) Patchset 2 update (edit Set up remote management of VMs) Patchset 2 update (add secret to other ClusterRoleBindings) Patchset 5 updates Patchset 6 updates Signed-off-by: Ron Stone <ronald.stone@windriver.com> Change-Id: I11e63f97c82f4cb3e92403e8a8423d892e3160a3
5.0 KiB
Create a Windows VM
This section provides an example of deploying a WindowsServer-based with KubeVirt.
The example uses:
A Windows Server 2019 image pre-installed in a qcow2 type image
- See https://superuser.openstack.org/articles/how-to-deploy-windows-on-openstack/ for information on how to create such an image using VirtualBox and starting with a Windows Server 2019 ISO image and Fedora VirtIO drivers.
- In order to make things easier, as part of making this image be sure
to:
- configure a well-known Administrator password,
- enable Remote Desktop, and
- enable Cloud-Init.
The Upload Proxy service to upload the Windows Server 2019 pre-installed qcow2 image into a DataVolume/, for the root disk,
Note that this image will be larger than previous ubuntu image so will take longer to load.
Explicit resource request for 4x CPUs and 8G of Memory
Multus and CNIs in order to add an additional -based interface.
These allow the to be assigned a unique IP Address from the IP Subnet attached to the -based interface.
Connect with the graphical console interface via Virtctl in order to extend the root disk and configure the IP Interface on the SRIOV-based interface.
Remote Desktop (RDP) from a remote workstation to the Windows 's unique IP Address on the IP Subnet attached to the -based interface.
This example assumes the same infrastructure changes as in the
previous Ubuntu VM example have been done here. i.e., interfaces
connecting to a 10.10.186.0/24 network on vlan-id=20 have been
configured on all hosts, and a NetworkAttachmentDefinition
,
186-subnet
, has been created to this network.
From a remote workstation that you have configured kubectl, virtctl and virt-viewer, follow the procedure below to create the Windows , login to the graphical console and configure the 's interface on the 10.10.186.0/24 network. Finally, RDP to the from a remote workstation.
Use
virtctl
and the CDI Upload Proxy service to load the Windows Server 2019 qcow2 image into a new DataVolume of size 500G, in the stx-lab namespace.$ virtctl image-upload dv stx-lab-winserv-test-disk --namespace stx-lab --insecure \ --access-mode ReadWriteOnce --size 100Gi --image-path \ /home/sysadmin/admin/kubevirt/images/winserv2019.qcow2 \ --uploadproxy-url https://admin.starlingx.abc.com:32111
Create the
yaml
file defining theVirtualMachine
instance$ cat <<EOF > stx-lab-winserv-test-vm.yaml apiVersion: kubevirt.io/v1alpha3 kind: VirtualMachine metadata labels: kubevirt.io/vm: stx-lab-winserv-test name: stx-lab-winserv-test namespace: stx-lab spec: running: true template: metadata: labels: kubevirt.io/vm: stx-lab-winserv-test spec: domain: devices: disks: - disk: bus: virtio name: myrootdisk interfaces: - masquerade: {} name: default - name: 186-subnet sriov: {} machine: type: q35 resources: requests: cpu: 4 memory: 8G terminationGracePeriodSeconds: 0 networks: - name: default pod: {} - multus: networkName: stx-lab/186-subnet name: 186-subnet volumes: - name: myrootdisk dataVolume: name: stx-lab-winserv-test-disk EOF
Apply the configuration.
$ kubectl apply -f stx-lab-winserv-test-vm.yaml
Connect to the graphical console, extend the root disk, and configure the 's interface on the 10.10.186.0/24 network.
$ virtctl -n stx-lab vnc --kubeconfig="/home/jdoe/.kube/config" stx-lab-winserv
This command launches Windows graphical console.
Login with well-known Administrator password set when the Windows Server 2019 qcow2 image was created.
Extend the root disk to fully use the space on the root disk.
Computer Management > Storage > Disk Management > Extend Volume (on the C: drive)
Configure the second ethernet adapter (SRIOV-based Interface).
For example:
- with static ip address in 10.10.186.0/24 subnet
- with the gateway ip address and
- with DNS address (10.10.186.130)
Logout of graphical console.
You can now RDP to the Windows using the 10.10.186.<nnn> IP Address.