fleetctl starts service only on one machine

  • Posted December 29, 2014

Hi, all. I’m trying to deploy services on two nodes in cluster. I have 4 machines:

fleetctl list-machines
MACHINE         IP              METADATA
054d4620...   -
6e36d587...   -
d6dbfc28...   role=node
e0369ccc...    role=node

And I want to deploy some service with created file (some.service):

Description=Some web application service

ExecStartPre=-/usr/bin/docker kill %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull user/package
ExecStart=/usr/bin/docker run --rm --name %n -p ${COREOS_PRIVATE_IPV4}:80:80 user/package
ExecStop=/usr/bin/docker stop -t 3 %n


The problem is when I run

fleetctl start some.service

service is deploying only on one machine but not on both nodes. What I’m doing wrong? Thanks


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

From the fleetctrl documentation on the CoreOS site,

When working with units, fleet distinguishes between two types of units: non-global (the default) and global. (A global unit is one with Global=true in its X-Fleet section, as mentioned above).

Non-global units are scheduled by the fleet engine - the engine is responsible for deciding where they should be placed in the cluster.

Global units can run on every possible machine in the fleet cluster. While global units are not scheduled through the engine, fleet agents still check the MachineMetadata option before starting them. Other options are ignored.

So by default, running a service with fleetctl will only run on a single node. Specifying MachineMetadata=role=node will tell fleetctl to only consider nodes tagged “role=node” but still will only launch on one of those. In order to launch the unit file on all nodes tagged “role=node” you’ll need to combine these attributes: