Since Fedora 27 Atomic recommends installing Kubernetes as a system container, what follows is a refresher on them featuring etcd.

System containers exist as a way to provide containerized services to a host before traditional container runtimes are ready. System containers do this by utilizing a runc and systemd units and do not deviate from the OCI standards. Let’s look at how someone can use a system containers to install the ever popular etcd today on Fedora 27 Atomic Host!

Atomic Host

The first thing one must have is Fedora 27 Atomic Host installed. As a reminder, Atomic Host allows people to use immutable infrastructure to deploy and scale your containerized applications. Project Atomic builds OSes, tools, and containers for cloud native platforms.

To grab a copy of the Fedora 27 version of Atomic Host head on over to the get fedora page for atomic.

Installing etcd

As one would expect, the atomic command is used for pulling, installing, updating, deleting, and manipulating system containers. Let’s install the etcd system container from the Fedora Layered Image Build System with the following command:

$ sudo atomic install --system --name=etcd
Pulling layer 01aae00bf9e4a7301133bac6641015fc1677a19ef13844f5b274cf6233515fdf
Pulling layer 9dbaf15c249f7ed8a76b8f2b785cc603172af8271e18cf28884bca36f7e39311
Extracting to /var/lib/containers/atomic/etcd.0
Created file /etc/etcd/etcd.conf
Created file /usr/local/bin/etcdctl
systemctl daemon-reload
systemd-tmpfiles --create /etc/tmpfiles.d/etcd.conf
systemctl enable etcd

What did we do? Let’s break it down:

  • sudo atomic: We are executing the atomic command with root privileges
  • install: We are denoting we want to install a container
  • --system: And the type of the container we want to install is a system container
  • --name etcd: The name of the container should be etcd
  • This is the image to use when creating the container

The output shows us:

  • The layers that were pulled
  • Where the containers root file system was extracted
  • Files that were created by the install of the container
  • systemd reload, tmpfiles, and service enablement

Configuration at Install Time

System containers allow for options to be set at install time. These options may be used for templating file contents, file names, and directory names. How does one figure out what options are available? The atomic command of course!

# atomic info --storage ostree
Image Name:

Template variables with default value, but overridable with --set:

As one can see there are quite a few options available. In fact, there are so many options some have been left out above for the sake of blog post readability. If we wanted to install the etcd container with, say, ETCD_DEBUG set to true and ETCD_SNAPSHOT_COUNT set to 10500 we would do the following install command:

$ sudo atomic install --system --name=etcd \
  --set ETCD_DEBUG=true \
  --set ETCD_SNAPSHOT_COUNT=10500 \

Running etcd

Since we named the container etcd the systemd service will also be called etcd. We could have called it anything, but for the sake of simplicity etcd works. So let’s take a look at the service:

$ sudo systemctl status etcd    
● etcd.service - Etcd Server
   Loaded: loaded (/etc/systemd/system/etcd.service; enabled; vendor preset: disabled)
   Active: inactive (dead)

As expected the service is currently not running but is enabled. So let’s start it up!

$ sudo systemctl start etcd
$ sudo systemctl status etcd
● etcd.service - Etcd Server
   Loaded: loaded (/etc/systemd/system/etcd.service; enabled; vendor preset: disabled)       
   Active: active (running) since Wed 2017-10-25 15:03:31 EDT; 13s ago
 Main PID: 1210 (runc)
    Tasks: 8 (limit: 4915)
   Memory: 16.0K
      CPU: 3ms
   CGroup: /system.slice/etcd.service
           └─1210 /bin/runc --systemd-cgroup run etcd

Well, that was easy!

Using etcd

The quickest way to check an etcd service is making REST calls. Atomic Host already has curl installed so let’s use that:

$ curl

We can see from the output that etcd is indeed running and responding to connections. Let’s ensure it’s also storing data:

$ curl -X PUT -d value="system container service"
{"action":"set","node":{"key":"/test","value":"system container service","modifiedIndex":4,"createdIndex":4}}
$ curl
{"action":"get","node":{"key":"/test","value":"system container service","modifiedIndex":4,"createdIndex":4}}

As we can see it’s storing and returning data fine. Remember when we installed the container and saw some files were created? One of them was etcdctl and was placed in /usr/local/bin/. This means that we should have access to the traditional etcdctl command.

$ etcdctl ls -r
$ etcdctl get test         
system container service


Since we installed the etcd system container without any special options we’ll need to edit the configuration file directly to make configuration changes. Just as it did with the etcdctl the system container install created /etc/etcd/etcd.conf. This file is used to configure etcd allowing the admin to modify it just as they would if they installed etcd via rpm or source install.

$ sudo vi /etc/etcd/etcd.conf
$ sudo systemctl restart etcd


System containers provide a way of running containerized system services early in the boot process and exposing administration in a way that operators have come to expect. Find more system containers via the system containers development and start containerizing your system services on Atomic Host!