No description
Find a file
Lenz Grimmer e5b84e72be
Update README.md (#1)
Add links to requirements.
Fix minor typos and wording issues.

Signed-off-by: Lenz Grimmer <lenz@grimmer.com>
2024-04-03 18:27:45 +02:00
.gitignore feat: initial templates 2024-03-30 17:01:00 +01:00
butane-oem.yaml feat: initial templates 2024-03-30 17:01:00 +01:00
flatcar.pkr.hcl fix: user data ignition is ignored 2024-04-03 08:48:11 +02:00
LICENSE feat: add license 2024-03-30 17:02:30 +01:00
README.md Update README.md (#1) 2024-04-03 18:27:45 +02:00

Build Flatcar Snapshots on Hetzner Cloud with Packer

Requirements

This only works on Flatcar version 3913.0.0 (or later), as this version has the appropriate versions of ignition and afterburn that include support for the Hetzner Cloud metadata service.

Building Snapshots

$ git clone ... # TODO
$ export HCLOUD_TOKEN=<Your Hetzner Cloud API Token>
$ packer init flatcar.pkr.hcl
$ butane butane-oem.yaml --pretty --strict --output=ignition-oem.json

# This will build Snapshots for x86 and arm. If you only need one, you can add
# `--only=hcloud.x86` or `--only=hcloud.arm` to the `packer build` command.
$ packer build flatcar.pkr.hcl
# ... Takes a few minutes
==> Builds finished. The artifacts of successful builds are:
--> hcloud.x86: A snapshot was created: 'flatcar-alpha-x86' (ID: 157132241)
--> hcloud.arm: A snapshot was created: 'flatcar-alpha-arm' (ID: 157132252)

$ hcloud image list --type=snapshot --selector=os=flatcar
ID          TYPE       NAME   DESCRIPTION         ARCHITECTURE   IMAGE SIZE   DISK SIZE   CREATED                        DEPRECATED
157132241   snapshot   -      flatcar-alpha-x86   x86            0.47 GB      20 GB       Sat Mar 30 16:48:22 CET 2024   -
157132252   snapshot   -      flatcar-alpha-arm   arm            0.42 GB      40 GB       Sat Mar 30 16:48:24 CET 2024   -

Create a Server

You can now create a new server from the snapshot. Not every feature might automatically work, as the snapshot is missing the functionality from hc-utils. Configuring SSH Keys and User Data (Ignition) will work as expected.

# Get ID of the most recent flatcar snapshot for x86
$ SNAPSHOT_ID=$(hcloud image list --type=snapshot --selector=os=flatcar --architecture=x86 -o=columns=id -o noheader --sort=created:desc | head -n1)

# Create a new server
# If you have, you can specify an Ignition config with `--user-data-from-file ignition-user.json`
$ hcloud server create --name flatcar-test --image $SNAPSHOT_ID --type cx11 --ssh-key <your-key>
# Wait about a minute or two for the server to be started

# Now you can login, the following is a helper that calls `ssh` with the public ipv4 address of the server
$ hcloud server ssh flatcar-test