General VM
Overview
Node type vm represents a general VM, each vm node is a kubevirt VM instance.
Configuration
Image
There are two support image access methods:
- a Kubevirt container disk image, with
docker://prefix, likedocker://example.registry/debian:v13 - a HTTP(s) URL to a qcow2 disk image with “http://” or “https://” prefix.
Example
Below example shows a lab with a vm-debian node connects to a pod, vm-debian uses a HTTPs URL of offical debian cloud image.
Persistent storage
Each VM node has a kubevirt data volumn based its image, so all files inside the VM are persistent even in case lab is removed. the VM disk size could be specified via diskSize in the node spec.
Initialization method
KNL supports two VM initialzation methods, which could specified by init field in the node spec:
- cloud-init (default)
- ignition
Default username and password of the VM could be specified via user and passwd field (default value is lab and lab123) which is installed via corresponding initiazation method.
Interface MAC, IP address and Routes
Optionally, a list of IP address could be assigned to the link interface via addrs field in the link spec; and also optionally a list of static routes could be specified using the interface as the egress, via routes field in format as <prefix> via <nexthop>;
The interface’s MAC address could be optionally specified via mac field in the link spec, an auto generated value is used by default.
These provisioned via the specified initialzation method.
Following is an example:
Listening ports
ports field in the node spec specifies a list of VM’s listening port on the default pod interface (the 1st interface). by default it only includes TCP port 22.
Readiness
readiness configures the KubeVirt readiness probe used to decide when the VM is ready. By default it is a TCP socket probe on port 22.
Any KubeVirt probe handler can be used (tcpSocket, httpGet, exec, or guestAgentPing). Exactly one handler must be specified. Set readiness: {} to disable readiness probing.
For tcpSocket / httpGet probes, the probed port must also be listed in ports, because the pod interface uses masquerade binding and only listed ports are forwarded into the guest.
Example overriding the default probe:
CPU & Memory
CPU and memory of the VM could be specified in the node spec, by default cpu is 2 and memory is 4GB, and optionally CPU pinning and hugepage memory (1G page size) could be enabled.