- adding system extensions
- updating kernel command line arguments
- using custom
METAcontents, e.g. for metal network configuration - generating SecureBoot images signed with a custom key
- generating disk images for SBC’s (Single Board Computers)
- using Image Factory service (recommended)
- manually using imager container image (advanced)
imager container can be used to generate images from main branch, with local changes, or with custom system extensions.
Image Factory
Image Factory is a service that generates Talos boot assets on-demand. Image Factory allows to generate boot assets for the official Talos Linux releases, official Talos Linux system extensions and official Talos Overlays. The main concept of the Image Factory is a schematic which defines the customization of the boot asset. Once the schematic is configured, Image Factory can be used to pull various Talos Linux images, ISOs, installer images, PXE booting bare-metal machines across different architectures, versions of Talos and platforms. Sidero Labs maintains a public Image Factory instance at https://factory.talos.dev. Image Factory provides a simple UI to prepare schematics and retrieve asset links.Example: Bare-metal with Image Factory
Let’s assume we want to boot Talos on a bare-metal machine with Intel CPU and add agvisor container runtime to the image.
Also we want to disable predictable network interface names with net.ifnames=0 kernel argument.
First, let’s create the schematic file bare-metal.yaml:
The schematic doesn’t contain system extension versions, Image Factory will pick the correct version matching Talos Linux release.And now we can upload the schematic to the Image Factory to retrieve its ID:
b8e8fbbe1b520989e6c52c8dc8303070cb42095997e76e812fa8892393e1d176 we will use to generate the boot assets.
The schematic ID is based on the schematic contents, so uploading the same schematic will return the same ID.Now we have two options to boot our bare-metal machine:
The Image Factory URL contains both schematic ID and Talos version, and both can be changed to generate different boot assets.Once the bare-metal machine is booted up for the first time, it will require Talos Linux
installer image to be installed on the disk.
The installer image will be produced by the Image Factory as well:
Once installed, the machine can be upgraded to a new version of Talos by referencing new installer image:
Example: AWS with Image Factory
Talos Linux is installed on AWS from a disk image (AWS AMI), so only a single boot asset is required. Let’s assume we want to boot Talos on AWS withgvisor container runtime system extension.
First, let’s create the schematic file aws.yaml:
d9ff89777e246792e7642abd3220a616afb4e49822382e4213a2e528ab826fe5 we will use to generate the boot assets.
Now we can download the AWS disk image from the Image Factory:
Now the aws-amd64.raw.xz file contains the customized Talos AWS disk image which can be uploaded as an AMI to the AWS.
Once the AWS VM is created from the AMI, it can be upgraded to a different Talos version or a different schematic using talosctl upgrade:
Imager
A custom disk image, boot asset can be generated by using the Talos Linuximager container: ghcr.io/siderolabs/imager:{release_v1_6 }.
The imager container image can be checked by verifying its signature.
The generation process can be run with a simple docker run command:
A quick guide to the flags used for docker run:
--rmflag removes the container after the run (as it’s not going to be used anymore)-tattaches a terminal for colorized output, it can be removed if used in scripts-v $PWD/_out:/secureboot:romounts the SecureBoot keys into the container (can be skipped if not generating SecureBoot image)-v $PWD/_out:/outmounts the output directory (where the generated image will be placed) into the container-v /dev:/dev --privilegedis required to generate disk images (loop devices are used), but not required for ISOs, installer container images
<image-kind> argument to the imager defines the base profile to be used for the image generation.
There are several built-in profiles:
isobuilds a Talos ISO image (see ISO)secureboot-isobuilds a Talos ISO image with SecureBoot (see SecureBoot)metalbuilds a generic disk image for bare-metal machinessecureboot-metalbuilds a generic disk image for bare-metal machines with SecureBootsecureboot-installerbuilds an installer container image with SecureBoot (see SecureBoot)aws,gcp,azure, etc. builds a disk image for a specific Talos platform
--archspecifies the architecture of the image to be generated (default: host architecture)--metaallows to set initialMETAvalues--extra-kernel-argallows to customize the kernel command line arguments. Default kernel arg can be removed by prefixing the argument with a-. For example-consoleremoves allconsole=<value>arguments, whereas-console=tty0removes theconsole=tty0default argument.--system-extension-imageallows to install a system extension into the image
Extension Image Reference
While Image Factory automatically resolves the extension name into a matching container image for a specific version of Talos,imager requires the full explicit container image reference.
The imager also allows to install custom extensions which are not part of the official Talos Linux system extensions.
To get the official Talos Linux system extension container image reference matching a Talos release, use the following command:
Note: this command is using crane tool, but any other tool which allows to export the image contents can be used.For each Talos release, the
ghcr.io/siderolabs/extensions:VERSION image contains a pinned reference to each system extension container image.
Example: Bare-metal with Imager
Let’s assume we want to boot Talos on a bare-metal machine with Intel CPU and add agvisor container runtime to the image.
Also we want to disable predictable network interface names with net.ifnames=0 kernel argument and replace the Talos default console arguments and add a custom console arg.
First, let’s lookup extension images for Intel CPU microcode updates and gvisor container runtime in the extensions repository:
Now we can generate the ISO image with the following command:
Now the _out/metal-amd64.iso contains the customized Talos ISO image.
If the machine is going to be booted using PXE, we can instead generate kernel and initramfs images:
Now the _out/kernel-amd64 and _out/initramfs-amd64 contain the customized Talos kernel and initramfs images.
Note: the extra kernel args are not used now, as they are set via the PXE boot process, and can’t be embedded into the kernel or initramfs.As the next step, we should generate a custom
installer image which contains all required system extensions (kernel args can’t be specified with the installer image, but they are set in the machine configuration):
The installer container image should be pushed to the container registry:
Now we can use the customized installer image to install Talos on the bare-metal machine.
When it’s time to upgrade a machine, a new installer image can be generated using the new version of imager, and updating the system extension images to the matching versions.
The custom installer image can now be used to upgrade Talos machine.
Example: AWS with Imager
Talos is installed on AWS from a disk image (AWS AMI), so only a single boot asset is required. Let’s assume we want to boot Talos on AWS withgvisor container runtime system extension.
First, let’s lookup extension images for the gvisor container runtime in the extensions repository:
Next, let’s generate AWS disk image with that system extension:
Now the _out/aws-amd64.raw.xz contains the customized Talos AWS disk image which can be uploaded as an AMI to the AWS.
If the AWS machine is later going to be upgraded to a new version of Talos (or a new set of system extensions), generate a customized installer image following the steps above, and upgrade Talos to that installer image.
Example: Assets with system extensions from image tarballs with Imager
Some advanced features ofimager are currently not exposed via command line arguments like --system-extension-image.
To access them nonetheless it is possible to supply imager with a profile.yaml instead.
Let’s use these advanced features to build a bare-metal installer using a system extension from a private registry.
First use crane on a host with access to the private registry to export the extension image into a tarball.
profile.yaml for our intended architecture and output.
In this case we want to build an amd64, bare-metal installer.
To build the asset we pass profile.yaml to imager via stdin