Hands on 2 - Provisioning
The goal of this hands-on is to:
- provision a local Flatcar instance
- write Butane configuration
- generate the Ignition configuration
- boot the instance with the config
This is what we’ve done in the previous hands-on but now it’s done as code, we want to deploy an Nginx container serving a “hello world” static webpage. As a reminder, Ignition configuration is used to provision a Flatcar instance, it’s JSON file generated from a Butane configuration (YAML).
- Clone the tutorial repository and cd into it:
git clone https://github.com/tormath1/flatcar-tutorial ; cd flatcar-tutorial/hands-on-2
./config.yamland find the TODO section.
- Add the following section (from https://coreos.github.io/butane/examples/#files):
storage: files: - path: /var/www/index.html contents: inline: Hello world
- Transpile the Butane configuration (
config.yaml) to Ignition configuration (
config.json) - it is possible to use the Butane binary or the Docker image
$ docker run --rm -i quay.io/coreos/butane:latest < config.yaml > config.json
- Download a Flatcar image (or use the zipped one from previous hands-on). NOTE: Ignition runs at first boot, it won’t work if you reuse your the previously booted image, always decompress again each time you change your Ignition config.
cp ../hands-on-1/flatcar_production_qemu_image.img.bz2 . bzip2 --decompress --keep ./flatcar_production_qemu_image.img.bz2 chmod +x flatcar_production_qemu.sh
- Start the image with Ignition configuration (
./flatcar_production_qemu.sh -i ./config.json -- -display curses
- Once on the instance, assert nginx works correctly (
systemctl status nginx.service)