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
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.
Click below to sign up and get $100 of credit to try our products over 60 days!
From the
fleetctrl
documentation on the CoreOS site,So by default, running a service with
fleetctl
will only run on a single node. SpecifyingMachineMetadata=role=node
will tellfleetctl
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: