containerscoreosrkt

How to run Etcd with Rocket


Right now I am using a systemd to run Etcd with a local binaries. I would like to run etcd with rkt, still thorugh systemd, so I would not need to 'manually' download the binaries with the binaries service.

# /etc/systemd/system/etcd2.service
[Unit]
After=binaries.service
Requires=binaries.service

[Service]
User=core
Type=notify
EnvironmentFile=/home/core/environment
ExecStart=/opt/bin/etcd
Restart=always

LimitNOFILE=40000
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target

I want to do something like. Is this right? Is there anything I am missing?

# /etc/systemd/system/etcd2.service
[Unit]
# Wait for networking
Requires=network-online.target
After=network-online.target

[Service]
User=core
Type=notify
EnvironmentFile=/home/core/environment
ExecStart==/usr/bin/rkt run --inherit-env --port=http:2380  --port=http:2379 quay.io/coreos/etcd:v2.3.3
Restart=always

LimitNOFILE=40000
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target

I have also found that etcd has some issues when runned by rocket about logging to stout/stderr. How would I debug this thing so I know whats going on. First day messing with rocket! Thanks!

The error I am getting

Sep 21 18:08:04 master systemd[1]: etcd2.service: Unit entered failed state.
Sep 21 18:08:04 master systemd[1]: etcd2.service: Failed with result 'exit-code'.
Sep 21 18:08:04 master systemd[1]: etcd2.service: Service hold-off time over, scheduling restart.
Sep 21 18:08:04 master systemd[1]: Stopped etcd2.service.
Sep 21 18:08:04 master systemd[1]: etcd2.service: Start request repeated too quickly.
Sep 21 18:08:04 master systemd[1]: Failed to start etcd2.service.

Solution

  • If you are running CoreOS, there is an 'etcd-wrapper' script and 'etcd-wrapper.service' systemd unit which do exactly this (run etcd from a rkt container).

    At the time of writing, the wrapper & unit file are only shipped in CoreOS beta (1153.4.0) and alpha (1164.1.0).

    If you're running a different version, or not running CoreOS at all - you can grab the scripts directly from: https://github.com/coreos/coreos-overlay/tree/master/app-admin/etcd-wrapper/files

    The wrapper scripts are still in alpha/beta status -- but these should be a good starting point.