Prerequirements
amd64 and arm64
Hetzner just launched its arm64-based cloud servers.
If we want to beable to create a Talos cluster based on arm64 we need to create two separate snapshots.
Packer configuration
hcloud_talosimage.pkr.hcl
Replace the LATEST_TALOS_VERSION with the latest release found here
packer {
required_plugins {
hcloud = {
version = ">= 1.0.0"
source = "github.com/hashicorp/hcloud"
}
}
}
variable "talos_version" {
type = string
default = "LATEST_TALOS_VERSION"
}
locals {
amd64_image = "https://github.com/siderolabs/talos/releases/download/${var.talos_version}/hcloud-amd64.raw.xz"
arm64_image = "https://github.com/siderolabs/talos/releases/download/${var.talos_version}/hcloud-arm64.raw.xz"
}
source "hcloud" "talos_amd64" {
rescue = "linux64"
image = "debian-11"
location = "fsn1"
server_type = "cx11"
ssh_username = "root"
snapshot_name = "talos amd64 ${var.talos_version}"
snapshot_labels = {
type = "infra",
os = "talos",
architecture = "amd64"
version = "${var.talos_version}",
}
}
source "hcloud" "talos_arm64" {
rescue = "linux64"
image = "debian-11"
location = "fsn1"
server_type = "cax11"
ssh_username = "root"
snapshot_name = "talos amd64 ${var.talos_version}"
snapshot_labels = {
type = "infra",
os = "talos",
architecture = "amd64"
version = "${var.talos_version}",
}
}
build {
sources = ["source.hcloud.talos_amd64"]
provisioner "shell" {
inline = [
"apt-get install -y wget",
"wget -O /tmp/talos.raw.xz ${local.amd64_image}",
"xz -d -c /tmp/talos.raw.xz | dd of=/dev/sda && sync",
]
}
}
build {
sources = ["source.hcloud.talos_arm64"]
provisioner "shell" {
inline = [
"apt-get install -y wget",
"wget -O /tmp/talos.raw.xz ${local.arm64_image}",
"xz -d -c /tmp/talos.raw.xz | dd of=/dev/sda && sync",
]
}
}
You will notice that there are 2 different build phases. This is necessary since we can not start an amd64 snapshot on an arm64 based server.
Building the images
Creating an Hetzner API token
Go to your Hetzner cloud console and click on your project.
Select the security tab and click on API tokens.
Create a token with read/write
access.
Build the images using packer
HCLOUD_TOKEN={TOKEN HERE} packer build .
When packer executes the file it will create two servers and creates the snapshots.
After everything is complete (this can take a long time) you should be able to view the created snapshots in your
Server => Snapshots folder