Running Flatcar on Brightbox

    These instructions will walk you through using Flatcar on Brightbox, importing a custom image, and running your first server using the command line interface. Please note that Brightbox is compatible with OpenStack: it is not a mistake if we refer to OpenStack images and specific variables.

    Import the image

    While Brightbox provides Flatcar images for Beta, Stable and LTS channels it is possible to import your own Flatcar image in Brightbox using the CLI .

    For example, to upload an image from the Flatcar Alpha channel:

    $ brightbox images register \
      --arch=x86_64 --name=flatcar-alpha \
    $ brightbox images list --type=upload
     id         owner      type    created_on  status   size  name
     img-xoufd  acc-jg5aa  upload  2023-12-05  private  8694  flatcar-alpha (x86_64)

    Butane Configs

    Flatcar allows you to configure machine parameters, launch systemd units on startup and more via Butane Configs. These configs are then transpiled into Ignition JSON configs and given to booting machines. Jump over to the docs to learn about the supported features . We’re going to provide our Butane Config to Brightbox via the user-data flag. Our Butane Config will also contain SSH keys that will be used to connect to the instance.

    As an example, this Butane YAML config will start an Nginx Docker container and display the instance hostname:

    variant: flatcar
    version: 1.0.0
        - name: core
            - ssh-rsa ABCD...
        - path: /var/www
        - name: nginx.service
          enabled: true
          contents: |
            Description=NGINX example
            After=docker.service coreos-metadata.service
            Requires=docker.service coreos-metadata.service
            ExecStartPre=-/usr/bin/docker rm --force nginx1
            ExecStartPre=-/usr/bin/bash -c "echo 'Hello from ${COREOS_OPENSTACK_HOSTNAME}' > /var/www/index.html"
            ExecStart=/usr/bin/docker run --name nginx1 --volume "/var/www:/usr/share/nginx/html:ro" --pull always --log-driver=journald --net host
            ExecStop=/usr/bin/docker stop nginx1

    Transpile it to Ignition JSON:

    cat butane.yaml | docker run --rm -i > ignition.json

    The coreos-metadata.service saves metadata variables to /run/metadata/flatcar. Systemd units can use them with EnvironmentFile=/run/metadata/flatcar in the [Service] section when setting Requires=coreos-metadata.service and After=coreos-metadata.service in the [Unit] section.

    Launch machine

    Boot the machines with the CLI, referencing the image ID from the import step above or using an official image ID (brightbox images list --type=official) and your Ignition file from Butane :

    $ brightbox servers create --cloud-ip=true --user-data-file=./ignition.json img-xoufd

    Your first Flatcar instance should now be running. The only thing left to do is find the IP address and SSH in.

    $ brightbox servers show $THE_INSTANCE_ID

    Finally SSH into an instance, note that the user is core:

    $ curl
    Hello from
    $ ssh [email protected]
    core@srv-f0lo3 ~ $ systemctl status nginx
    ● nginx.service - NGINX example
         Loaded: loaded (/etc/systemd/system/nginx.service; enabled; preset: enabled)
         Active: active (running) since Tue 2023-12-05 16:25:06 UTC; 1min 53s ago

    ⚠️ In the following example, the default firewall policy created during account registration has been used, which permits access to TCP ports 22 and 80. If you’ve modified the default firewall policy then you may need to take additional steps to open access. Here’s the documentation to update the firewall policies:

    Using Flatcar Container Linux

    Now that you have a machine booted it is time to play around. Check out the Flatcar Container Linux Quickstart guide or dig into more specific topics .