CoreOS Cheat Sheet

This is a work in progress. I update this as I learn things.

Things To Know

cloud-config

Configuration file used by coreOS to configure itself. Processed on every system boot. Unit files define your units. drop-ins can be inside unit files. Think of drop-ins as, “drop in replacement” for a key/value that is already defined in a service. drop-ins override already defined settings.

systemd-delta

Find overridden configuration files

etcd

A key/value store that is distributed among all machines in your cluster. Peers and clients connect to etcd. Peers are other servers in your cluster. Clients are tools like etcdctl which make changes to the key/value store. Depending on version, listens on TCP port [2379|4001] for etcd clients, and [2380|7001] for peers.

Depending on what platform you’re using (AWS, DigitalOcean, bare metal, etc.), as well as the version of coreOS you are running, you may or may not have an /etc/environment file. This file contains two environment variables which help your docker containers get the private IP address of their host. This file is important for etcd because without the containers knowing the private IP of their host, there’s no way for your containers to write to etcd. There’s been some developer conversation on whether this file is even going to be included by default in coreOS. In either case, if you don’t have one on your coreOS, there are methods here of generating one yourself (https://github.com/coreos/bugs/issues/65)

Useful Commands

Show the coreOS version you’re running

cat /etc/os-release

Show status of all units

systemctl list-units

Show failed units

systemctl --failed

Show units of a certain type (failed, active, waiting, etc.)

systemctl --state=waiting

reload etcd configuration

Use this when you changed a unit file on disk. example, you updated /etc/systemd/system/teamspeak3.service

systemctl daemon-reload

see status of etcd

systemctl status etcd

To see all local configuration:

systemd-delta

To see all runtime configuration:

systemd-delta /run

To see all system unit configuration changes:

systemd-delta systemd/system

To see all runtime “drop-in” changes for system units:

systemd-delta --type=extended /run/systemd/system

How To Install New Software

Every piece of software is run in a docker container.

Create a unit file like this, with the name, [SERVICENAME].service (full docs)

Copy the file to the systemd unit file directory

# cp ~/lighttpd.service /etc/systemd/system/

Enable the unit file

Start the unit
# systemctl start lighttpd.service

Follow the unit’s progress

Open a terminal in a running docker container

In this example, we connect to the teamspeak3 (TS3) container we created previously.

docker exec -i -t TS3 /bin/bash

Now we are free to browse around the container, check logs, change things, etc.