Running Flatcar Container Linux on OpenStack

    These instructions will walk you through downloading Flatcar Container Linux for OpenStack, importing it with the glance tool, and running your first cluster with the nova tool.

    Import the image

    These steps will download the Flatcar Container Linux image, uncompress it, and then import it into the glance image store.

    Choosing a channel

    Flatcar Container Linux is designed to be updated automatically with different schedules per channel. You can disable this feature , although we don’t recommend it. Read the release notes for specific features and bug fixes.

    The Alpha channel closely tracks master and is released frequently. The newest versions of system libraries and utilities will be available for testing. The current version is Flatcar Container Linux 3066.0.0.

    $ wget
    $ bunzip2 flatcar_production_openstack_image.img.bz2

    The Beta channel consists of promoted Alpha releases. The current version is Flatcar Container Linux 3033.1.1.

    $ wget
    $ bunzip2 flatcar_production_openstack_image.img.bz2

    The Stable channel should be used by production clusters. Versions of Flatcar Container Linux are battle-tested within the Beta and Alpha channels before being promoted. The current version is Flatcar Container Linux 2983.2.1.

    $ wget
    $ bunzip2 flatcar_production_openstack_image.img.bz2

    Once the download completes, add the Flatcar Container Linux image into Glance:

    $ glance image-create --name Container-Linux \
      --container-format bare \
      --disk-format qcow2 \
      --file flatcar_production_openstack_image.img
    | Property         | Value                                |
    | checksum         | 4742f3c30bd2dcbaf3990ac338bd8e8c     |
    | container_format | ovf                                  |
    | created_at       | 2013-08-29T22:21:22                  |
    | deleted          | False                                |
    | deleted_at       | None                                 |
    | disk_format      | qcow2                                |
    | id               | cdf3874c-c27f-4816-bc8c-046b240e0edd |
    | is_public        | False                                |
    | min_disk         | 0                                    |
    | min_ram          | 0                                    |
    | name             | flatcar                               |
    | owner            | 8e662c811b184482adaa34c89a9c33ae     |
    | protected        | False                                |
    | size             | 363660800                            |
    | status           | active                               |
    | updated_at       | 2013-08-29T22:22:04                  |

    Optionally add the --visibility public flag to make this image available outside of the configured OpenStack account tenant.

    Container Linux Configs

    Flatcar Container Linux allows you to configure machine parameters, launch systemd units on startup and more via Container Linux Configs. These configs are then transpiled into Ignition configs and given to booting machines. Jump over to the docs to learn about the supported features . We’re going to provide our Container Linux Config to OpenStack via the user-data flag. Our Container Linux Config will also contain SSH keys that will be used to connect to the instance. In order for this to work your OpenStack cloud provider must support config drive or the OpenStack metadata service.

    A common Container Linux Config for OpenStack looks like:

      # All options get passed as command line flags to etcd.
      # Any information inside curly braces comes from the machine at boot time.
      # multi_region and multi_cloud deployments need to use {PUBLIC_IPV4}
      advertise_client_urls:       "http://{PRIVATE_IPV4}:2379"
      initial_advertise_peer_urls: "http://{PRIVATE_IPV4}:2380"
      # listen on both the official ports and the legacy ports
      # legacy ports can be omitted if your application doesn't depend on them
      listen_client_urls:          ""
      listen_peer_urls:            "http://{PRIVATE_IPV4}:2380"
      # generate a new token for each unique cluster from
      # specify the initial size of your cluster with ?size=X
      discovery:                   "<token>"
        - name: core
            - ssh-rsa ABCD...

    The {PRIVATE_IPV4} and {PUBLIC_IPV4} substitution variables are fully supported in Container Linux Configs on OpenStack deployments using the metadata service. Unfortunately systems relying on config drive are currently unsupported.

    Launch cluster

    Boot the machines with the nova CLI, referencing the image ID from the import step above and your JSON file from ct :

    nova boot \
    --user-data ./config.ign \
    --image cdf3874c-c27f-4816-bc8c-046b240e0edd \
    --key-name flatcar \
    --flavor m1.medium \
    --min-count 3 \
    --security-groups default,flatcar

    To use config drive you may need to add --config-drive=true to command above.

    If you have more than one network, you may have to be explicit in the nova boot command.

    --nic net-id=5b9c5ef6-28b9-4781-ac18-d7d86765fd38

    You can see the IDs for your configured networks by running

    nova network-list
    | ID                                   | Label   | Cidr |
    | f54b48c7-34fc-4828-8ee9-21b623c7b8f9 | public  | -    |
    | 5b9c5ef6-28b9-4781-ac18-d7d86765fd38 | private | -    |

    Your first Flatcar Container Linux cluster should now be running. The only thing left to do is find an IP and SSH in.

    $ nova list
    | ID                                   | Name            | Status | Task State | Power State | Networks           |
    | a1df1d98-622f-4f3b-adef-cb32f3e2a94d | flatcar-a1df1d98 | ACTIVE | None       | Running     | private=  |
    | db13c6a7-a474-40ff-906e-2447cbf89440 | flatcar-db13c6a7 | ACTIVE | None       | Running     | private=  |
    | f70b739d-9ad8-4b0b-bb74-4d715205ff0b | flatcar-f70b739d | ACTIVE | None       | Running     | private=  |

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

    $ chmod 400 core.pem
    $ ssh -i core.pem [email protected]
    [email protected] ~ $

    Adding more machines

    Adding new instances to the cluster is as easy as launching more with the same Container Linux Config. New instances will join the cluster assuming they can communicate with the others.


    nova boot \
    --user-data ./config.ign \
    --image cdf3874c-c27f-4816-bc8c-046b240e0edd \
    --key-name flatcar \
    --flavor m1.medium \
    --security-groups default,flatcar

    Multiple clusters

    If you would like to create multiple clusters you’ll need to generate and use a new discovery token. Change the token value on the etcd discovery parameter in the Container Linux Config, and boot new instances.

    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 .