VirtualMachineConfig document in the host’s machine configuration. Talos creates the virtual machine from the document and keeps it matching the document.
A document is added to the host with talosctl patch machineconfig. For a full walkthrough, see Run your first virtual machine.
This page describes each setting in the document, how to check a virtual machine’s status, and how to remove a virtual machine.
Example configuration
The following document describes a virtual machine namedvm1. It has two virtual CPUs and 2 GiB of memory, boots from an ISO in the content library images, has its serial console enabled, and connects to the host link eth0:
name, powerState, cpu, memory, and firmware. The other sections are optional.
The name identifies the virtual machine in Talos resources and talosctl commands. It can contain only ASCII letters, digits, and hyphens, and can be up to 63 characters long.
Virtual machine settings
Each section below covers one part of the document.Power state
ThepowerState field sets the state Talos keeps the virtual machine in:
runningstarts the virtual machine and keeps it running.stoppedturns off the virtual machine immediately, without a clean shutdown of the guest, and removes it from libvirt. SettingpowerStateback torunningstarts it again.
suspended, but Talos does not support it. A virtual machine set to suspended reports the error stage and stays as it is.
Processors
Thecpu.count field sets how many virtual CPUs the guest sees. The other processor settings are optional:
limitcaps how much host CPU time the virtual machine can use, in millicores.1000mis one host core. For example, a guest with four virtual CPUs and a2000mlimit sees four processors, but gets at most two cores of host time. Without a limit, the virtual machine is limited only by its number of virtual CPUs.topologysets how the guest sees its virtual CPUs: as sockets, cores per socket, and threads per core. Set all three or none. Multiplied together, they must equalcount.topology.pinningties virtual CPUs to specific host CPUs, given as Linux CPU lists such as8or9-10. Pinning works withoutsockets,cores, andthreads, and does not reserve the host CPUs for this virtual machine.- Each entry in
vcpuspins one virtual CPU, counted from0. A virtual CPU without an entry can run on any host CPU. emulatorpins the rest of the virtual machine’s threads.
- Each entry in
Memory
Thememory.size field sets how much memory the guest has when it boots, such as 2GiB. The other memory settings are optional:
ballooning.enabledadds a virtio balloon device to the guest. Talos does not set a balloon target.numakeeps the guest’s memory on specific host NUMA nodes, given as a Linux node list such as1or0-1. Themodefield sets how strict this is:strict, the default, fails memory requests that the listed nodes cannot serve.preferredfalls back to other nodes.interleavespreads memory across the listed nodes.
Firmware
Thefirmware.type field sets the firmware the guest boots with: bios or uefi. On arm64 hosts, only uefi works. Talos accepts bios on arm64, but the virtual machine then fails to start.
A guest installed with one firmware type does not boot with the other. Keep firmware.type the same after a guest is installed.
To boot the guest with secure boot, set firmware.secureBoot.enabled to true. Secure boot needs uefi.
Disks
Each entry indisks attaches a disk to the virtual machine. The type field sets the kind of disk:
disk, the default, is a writable disk stored in a storage pool.cdromis a read-only CD-ROM that attaches an image from a content library.
nameidentifies the disk within the virtual machine. It can contain only ASCII letters, digits, and hyphens, and can be up to 63 characters long.bootOrdersets the disk’s place in the boot order, lowest first. Each value must be unique within the virtual machine. Set it on the disk the guest boots from.
Writable disks
A writable disk is created empty in a storage pool:poolnames the storage pool that stores the disk. The pool must be declared in the host’s machine configuration. To declare one, see Create a storage pool.sizesets the size of the disk, such as20GiB.provision.blankcreates the disk empty. A writable disk cannot be created from a content library image.formatsets the file format of the disk,qcow2by default orraw.bussets the controller the disk connects to,virtioby default, orscsiorsata. A guest without virtio drivers needssata.
<vm-name>__<disk-name>.<format> in the pool. The file is kept when the disk or the virtual machine is removed, and a disk with the same virtual machine name and disk name in the same pool attaches the existing file again.
The size of a disk can only grow. A larger size takes effect the next time no running virtual machine uses the disk, and a smaller size is ignored.
CD-ROM disks
A CD-ROM disk attaches an image from a content library, read-only:provision.fromImagenames the content library and the file in it. The library must be declared in the host’s machine configuration. The optionaldigestpins the file to a checksum. See Upload and manage images.bussets the controller the disk connects to. A CD-ROM usessataby default, and can also usescsi. It cannot usevirtioornvme.
pool, size, format, or provision.fromImage.mode.
Consoles
A virtual machine has two consoles, both turned off by default:serialattaches a serial port, for a text console.vncattaches a display, for a graphical console.
video section selects a different display:
modelisvgaby default, orvirtio,bochs, orcirrus.vramMiBsets the display’s video memory in MiB, as a power of two. It applies only tovga, from 1 to 512, andbochs, from 4 to 256.
video section has no effect on arm64 hosts or when the VNC console is off.
To use the consoles, see Access the virtual machine console.
Network interfaces
Each entry innetworking.interfaces adds a network interface to the virtual machine. A virtual machine with no interfaces has no network connection.
nameidentifies the interface within the virtual machine. It is not the device name inside the guest, which the guest operating system chooses.linkis the name or alias of an Ethernet link on the host, such as a physical interface, a bond, or a VLAN. It can be up to 15 characters long.hardwareAddrsets the interface’s MAC address. It must be a unicast address.
hardwareAddr when:
- Hosts that run virtual machines with the same names share a network.
- A DHCP server reserves an address for the guest.
- The address must stay the same after a rename.
Guest setup with cloud-init
Theguest.cloudInit section passes settings to the guest for its first boot, so the guest can set itself up without manual steps. Talos packs the settings into a small ISO labeled CIDATA, stores it in a content library as cloud-init-<hash>.iso, and attaches it to the virtual machine as a CD-ROM. The guest reads it with cloud-init. Talos replaces the ISO when the settings change, which restarts a running guest, and deletes it when the virtual machine is removed.
The following example sets the guest’s hostname, an administrator account, and a fixed IP address:
librarynames the content library that stores the ISO. It is required, and the library must be declared in the host’s machine configuration.metaDataholds the guest’s identity. Include aninstance-id: cloud-init uses it to tell a reboot from a new virtual machine. Changing it makes the guest run its setup again. Without it, changes touserDatamay not take effect.userDataholds what to set up. For most Linux distributions, this is a cloud-config document that starts with#cloud-config. For a Talos Linux guest, it is the guest’s machine configuration.networkConfigholds network settings, for guests that cannot get them over DHCP.
metaData, userData, and networkConfig must be set, and together they can be up to 4 MiB. Talos stores them as plain text in the machine configuration, which only users with the Admin role can read.
A Talos Linux guest reads these settings only when it boots the nocloud image from Image Factory, not the metal image. It uses them as follows:
userDatais the guest’s machine configuration. A document that starts with#cloud-configis ignored. Without a machine configuration, the guest keeps waiting for one and does not enter maintenance mode.- The hostname in
metaDatais applied only whennetworkConfigis also set.
guest.agent.enabled field attaches a channel for the QEMU guest agent, a program that can run inside the guest. Talos reads the guest’s IP addresses through this channel and shows them in the virtual machine status. The channel is on by default. To remove it, set enabled to false.
How changes are applied
A change is applied with a patch that has the document’sapiVersion, kind, and name, and the fields to change. The patch merges into the existing document:
- Entries in
disksare matched by name. An entry with an existing name updates that disk, and an entry with a new name adds a disk. A patch cannot remove a disk. To remove one, edit the machine configuration withtalosctl edit machineconfig. - The
networking.interfacesandcpu.topology.pinning.vcpuslists are replaced as a whole by the list in the patch.
- A disk’s content library file is removed, or no longer matches its pinned digest.
- The host link named in
linkno longer exists.
Check a virtual machine’s status
Talos reports what it sees about each virtual machine in three resources. Replace<host-ip> in the following commands with the host’s IP address.
Virtual machine status
TheVirtualMachineStatus resource shows how far each virtual machine has progressed toward its declared state:
POWER column shows the power state Talos observes: running, stopped, or unknown.
The STAGE column shows the progress:
unknownmeans Talos has not seen the virtual machine in libvirt yet. A virtual machine set tostoppedstays atunknown, because a stopped virtual machine is removed from libvirt.pendingmeans Talos is still starting the virtual machine, or is waiting for something on the host, such as a host link or a disk that is not ready.readymeans the virtual machine is in its declared state.errormeans something stops the virtual machine from reaching its declared state. For example, a writable disk is set to be provisioned from an image, the host link is not an Ethernet link, the power state is not supported, or the name is already used by a libvirt domain that Talos did not create.
ADDRESSES column shows the guest’s IP addresses. Talos reads them from the QEMU guest agent, so the column stays empty for a guest that does not run it.
When Talos knows what it is waiting for or what went wrong, the ERROR column says so.
Disk status
TheVirtualMachineDiskStatus resource shows each disk of each virtual machine:
MACHINEandDISKname the virtual machine and the disk.POOLis the storage pool that holds a writable disk. It is empty for a CD-ROM.PHASEisreadyonce the disk can be attached.SOURCEis the file on the host that the disk is attached from.ERRORexplains why a disk is not ready, for example because its content library file is missing or does not match its pinned digest.
libvirt domains
libvirt calls each virtual machine a domain. TheVirtualMachineDomainStatus resource shows every domain libvirt has on the host, including domains that Talos did not create:
Remove a virtual machine
To remove a virtual machine, delete its document with a patch. Talos turns the virtual machine off immediately and removes it from libvirt. Its most recent console output stays readable withtalosctl logs --kind=vm.
Run the following command to create vm1-delete.yaml, a patch that deletes the vm1 document:
<host-ip> with the host’s IP address: