Flatcar installation
Flatcar Container Linux is designed from the ground up for running container workloads. It fully embraces the container paradigm, including only what is required to run containers.
Flatcar allows you to create Kubernetes clusters with ease based on immutable Linux nodes.
With i3D.net FlexMetal you can boot Flatcar nodes using the Custom iPXE feature. On this page we will describe the process.
Create your custom iPXE script
To boot the Flatcar OS, you must use the Custom iPXE feature when requesting a FlexMetal server. Below you will find how to perform an API request to do that.
Inside the iPXE script, you must point to the version of Flatcar you want to boot, while also providing the URL to your ignition configuration file. This URL should point to the Metadata API userdata endpoint, so that the ignition configuration is fetched from your server's userdata during boot.
Example iPXE script
This is an example iPXE script to boot the latest LTS version of the Flatcar OS, using Custom iPXE network variables to configure the network for the initial boot phase. Note the ignition.config.url kernel parameter that points to the userdata endpoint, which will serve the ignition configuration you uploaded as userdata when creating the server. See how to set userdata to your configuration file in the example request section below.
#!ipxe
set bootimage_url https://lts.release.flatcar-linux.net/amd64-usr/current
set os_parameters initrd=flatcar_production_pxe_image.cpio.gz flatcar.first_boot=1 ignition.config.url=https://metadata.i3d.net/v1/userdata flatcar.autologin net.ifnames=0 hostname=${IPXE_BOOT_HOSTNAME} ${IPXE_BOOT_LINUX_IP_CONFIG}
kernel ${bootimage_url}/flatcar_production_pxe.vmlinuz ${os_parameters}
initrd ${bootimage_url}/flatcar_production_pxe_image.cpio.gz
boot[!NOTE] You can also set the ignition config url to download the config file from your own server if you prefer. For example:
ignition.config.url=https://my-server.com/ignition-configuration.ign
More details can be found on Flatcar's iPXE boot documentation.
Example FlexMetal API request
To request a FlexMetal server via our API, you select the custom-ipxe OS with the ipxeScriptUrl parameter pointing to your custom iPXE script and provide your ignition configuration as userdata:
POST https://api.i3d.net/v3/flexMetal/servers
Request body:
The SSH keys and tags you provide can be fetched from the Metadata API during configuration of Flatcar using ignition.
When requesting a FlexMetal server with the
custom-ipxeOS, thedeliveredstate will be set as soon as the iPXE boot script is downloaded. This means that the OS images must still be downloaded and the OS needs to start up and come online.
Ignition configuration
Your ignition configuration file determines how to setup Flatcar as it is booting. What you configure here is up to you. You can find the full ignition configuration in Flatcar's ignition documentation.
Flatcar configuration using Metadata
Flatcar uses Butane/Ignition to configure the OS during first boot. When booting Flatcar via iPXE, you can pass a URL pointing to the Ignition configuration file where you can include a directive to use the i3D.net Metadata API for [network] configuration. This requires two configurations: one to download a script to perform the configuration and one to run the script.
The functionality of this process is based on https://www.flatcar.org/docs/latest/provisioning/ignition/dynamic-data/
i3D.net does not have direct integration with CoreOS or Flatcar, so you cannot use the
providerkernel directive at this time to perform automatic configuration.
Ignition configuration file additions
Download the Metadata configuration script metadata-script.sh and store it in /opt/get-metadata.sh . An example script is provided in the next chapter below. You can host this on your own web server, or you can provide it to Ignition as a base64 encoded file instead.
Run the downloaded Metadata configuration script:
Metadata configuration script
The following bash script can be used for the Metadata configuration script as referenced in the Ignition configuration above. This will download a server's metadata, install the SSH keys for the core user, and configure the network. The network is only (re)configured when the server has NIC bonding, which FlexMetal servers are always delivered with. By default Flatcar automatically configures a single uplink according to the ip kernel parameter.
[!NOTE] Flatcar does not provision SSH keys out of the box. Unless you declare keys under
passwd.users[].sshAuthorizedKeysin your ignition configuration, you must install them from the Metadata API as shown below — otherwise the server will be unreachable via SSH after boot.
You can customize this script if needed.
You must host this script at a location from which your server can download it.
metadata-script.sh
Running a userdata script
The userData object carries a single blob in userData.data (optionally with isBase64), so you need to pick one of the following patterns — that single userData.data payload cannot be both an ignition config and a post-boot script at the same time:
userData.dataholds the ignition config (the pattern shown in the example iPXE script earlier in this guide, viaignition.config.url=https://metadata.i3d.net/v1/userdata). If you also need a post-boot script, host it at a URL your server can reach, or embed it in the ignition config as astorage.filesentry.userData.dataholds a post-boot script. Host your ignition config at a URL of your own (e.g.https://example.org/ignition.cfg) and point the iPXE script at that URL viaignition.config.url=. Then fetch the userdata payload from withinmetadata-script.shand execute it, as shown below.
The snippet below covers the second pattern.
[!IMPORTANT] The userdata fetch must be placed before the bond reconfiguration (i.e., before the
If there's no bondblock). The bond reconfiguration restartssystemd-networkd, during which LACP renegotiates and connectivity is briefly unavailable — any network call made at that point will fail or return a partial response, which can leave a truncated or empty file on disk. Running the fetch earlier keeps it on the pre-bond network that is already up from iPXE boot.
Insert the following block in metadata-script.sh after the JSON validation block and the SSH-key provisioning block, but still before the If there's no bond block:
The curl flags are worth calling out:
-f— fail on HTTP errors instead of writing an error body to the file-S/-L— surface errors and follow redirects--retry 10 --retry-delay 2 --retry-connrefused— survive transient connectivity blips--max-time 30— bounded overall wait so the service cannot hang indefinitely
Invoking via bash /opt/userdata.sh instead of relying on the shebang means execution does not silently depend on the first line of the downloaded content being a valid interpreter directive.
The isBase64 flag on the create-server request is submission-side only, and exists because a JSON request body can only carry string values — so if your payload is binary (a zip, a compiled binary, an image, etc.) you must base64-encode it and set isBase64: true to get it through the API at all. When i3D receives a payload marked with isBase64: true it decodes it on submission and stores the original raw bytes.
The userdata endpoint always returns those stored raw bytes. Your Flatcar server does not need to base64 -d the response — whether you submitted the payload as plain text or as base64 with isBase64: true, the bytes returned by curl https://metadata.i3d.net/v1/userdata are the original, decoded content. The snippet above writes that response straight to /opt/userdata.sh and runs it, which is correct in both cases.
If your userdata is not a shell script (for example a JSON config or a binary file), adjust the output path and drop the chmod u+x / bash execution lines accordingly.
Last updated
Was this helpful?