Report this

What is the reason for this report?

fleetctl starts service only on one machine

Posted on 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...     10.132.142.91   -
6e36d587...     10.132.142.90   -
d6dbfc28...     10.132.142.88   role=node
e0369ccc...     10.132.141.7    role=node

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

[Unit]
Description=Some web application service

[Service]
EnvironmentFile=/etc/environment
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

[X-Fleet]
MachineMetadata=role=node

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



This textbox defaults to using Markdown to format your 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:

[X-Fleet]
Global=true
MachineMetadata=role=node

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.