This directory contains Packer configuration to build Talos OS images suitable for use with Hetzner Cloud.
Warning
The _packer/ workflow is deprecated and no longer maintained.
Use hcloud-talos/imager for new clusters and ongoing updates.
This directory remains only as a legacy fallback for users who still rely on the old Packer flow.
Tip
It's good practice to always create a _packer/hcloud.auto.pkrvars.hcl file to explicitly set the talos_version. This ensures the Packer build uses the exact Talos version you intend to deploy with Terraform, preventing potential mismatches if the default value in talos-hcloud.pkr.hcl is outdated or if you are using custom images from the Image Factory.
Your hcloud.auto.pkrvars.hcl would simply contain:
# _packer/hcloud.auto.pkrvars.hcl
talos_version = "v1.7.0" # Replace with your desired Talos version
# Optionally, set custom server type for building snapshot:
# server_type_arm = "cax21"
# server_type_x86 = "cx33"
# Optionally, Hetzner Cloud location (region) where the temporary build server is created.
# Use a location where the provided server types are available.
# server_location = "fsn1"
# Optionally, add custom image URLs if using the Image Factory:
# image_url_arm = "https://factory.talos.dev/image/<SCHEMATIC_ID>/<TALOS_VERSION>/hcloud-arm64.raw.xz"
# image_url_x86 = "https://factory.talos.dev/image/<SCHEMATIC_ID>/<TALOS_VERSION>/hcloud-amd64.raw.xz"To build the standard Talos images (ARM and x86) without any custom extensions, simply run the create.sh script:
./create.shThis script will:
- Check if Packer is installed.
- Prompt for your Hetzner Cloud API token (
HCLOUD_TOKEN) if it's not set as an environment variable. - Initialize Packer.
- Run
packer buildusing the default image URLs defined intalos-hcloud.pkr.hcl. - Store the resulting snapshots in your Hetzner Cloud project.
The Talos OS version used for the default images is defined by the talos_version variable in talos-hcloud.pkr.hcl. If you haven't created hcloud.auto.pkrvars.hcl to override it, this default value will be used.
If you need to include additional system extensions in your Talos images (e.g., for specific storage drivers or tools), you can use the Talos Image Factory.
-
Define Extensions: Adjust the
schematic.yamlfile to include the official or custom extensions you need. The current file includes examples foriscsi-tools,util-linux-tools, andbinfmt-misc. -
Generate Schematic ID: Use the Talos Image Factory endpoint to generate a unique ID for your schematic configuration:
curl -X POST --data-binary @schematic.yaml https://factory.talos.dev/schematics
This command will return a JSON response containing the schematic ID.
-
Get Custom Image URLs: Use the schematic ID and the desired Talos version to construct the URLs for the custom images:
- ARM:
https://factory.talos.dev/image/<SCHEMATIC_ID>/<TALOS_VERSION>/hcloud-arm64.raw.xz - x86:
https://factory.talos.dev/image/<SCHEMATIC_ID>/<TALOS_VERSION>/hcloud-amd64.raw.xz
Replace
<SCHEMATIC_ID>with the ID obtained in the previous step and<TALOS_VERSION>with the target Talos version (e.g.,v1.7.0). - ARM:
-
Override Packer Variables: Create a file named
hcloud.auto.pkrvars.hclin this directory to provide the custom image URLs and the corresponding Talos version to Packer. The file should look like this:# _packer/hcloud.auto.pkrvars.hcl talos_version = "<TALOS_VERSION>" # e.g., "v1.7.0" image_url_arm = "https://factory.talos.dev/image/<SCHEMATIC_ID>/<TALOS_VERSION>/hcloud-arm64.raw.xz" image_url_x86 = "https://factory.talos.dev/image/<SCHEMATIC_ID>/<TALOS_VERSION>/hcloud-amd64.raw.xz"
Replace the placeholders with your actual schematic ID and Talos version. Remember to also set the
talos_versionvariable in this file, as recommended in the tip at the beginning of this document. -
Build the Images: Run the
create.shscript as usual:./create.sh
Packer will automatically pick up the variables from
hcloud.auto.pkrvars.hcland use your custom image URLs instead of the defaults.