Netboot iPxe

Ok, we have our Raspberry Pis, ready to run containers now !
We could straight away go and install K3s to run containerized applications in our cluster
Across our journey, here it comes FedoraCoreOS, a minimal operative system designed run container workloads,
it can autoupdate itslef, and providing immutability to the underlying system.
An even more interesting feature, is the possibility to run it entirely on RAM,
and each reboot, reprovision and reconfigure itself trough a config file in Ignition.
But how could this be achieved ?
The answer is piPxe, providing extended capabilities to existing PXE structure,
allowing each reboot to pull a new image of CoreOS directly from the repository.

Credits to valtzu for this awesome automated build : Repository

git clone https://github.com/valtzu/pixpe
cd pixpe
docker-compose up 

piPxe will be built and file sdimage.img will be found, we flash it to an SD card.
Further steps to allow a fully diskless approach, will be investigated.
We need to change the bootfile in our DHCP configuration, the file is ipxe.txt
The content is the following :

#!ipxe

set STREAM stable
set VERSION 35.20220131.3.0
set CONFIGURL http://ipxe.server.net/node.ign

kernel https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/35.20220213.3.0/aarch64/fedora-coreos-35.20220213.3.0-live-kernel-aarch64 initrd=main coreos.live.rootfs_url=https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/35.20220213.3.0/aarch64/fedora-coreos-35.20220213.3.0-live-rootfs.aarch64.img   ignition.firstboot ignition.platform.id=metal ignition.config.url=${CONFIGURL}
initrd --name main https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/35.20220213.3.0/aarch64/fedora-coreos-35.20220213.3.0-live-initramfs.aarch64.img

boot

We need to deliver a config with Igintion file, to provision CoreOS.
This will allow us to configure at boot time disks, fileystsems, users an even systemd services.
To produce a working ignition file, we can use the Butane utility : Butane
Write down the configuration in a yaml file, and parse it with Butane to produce a .ign
Example baseline config :

variant: fcos
version: 1.4.0
passwd:
  users:
    - name: core
      ssh_authorized_keys:
        - ecdsa-sha2-nistp384  [email protected]

systemd:
  units:

    - name: settimezone.service
      enabled: true
      contents: |
        [Unit]
        Description=Set local time zone

        [Install]
        WantedBy=multi-user.target

        [Service]
        Type=oneshot
        RemainAfterExit=yes
        ExecStart=/usr/bin/timedatectl set-timezone Europe/Prague

Further indication on how to produce the ignition in the official docuentation : FCOS Docs

Power on your pi,
Enjoy !

Comments

Subscribe to our Newsletter