Etcd + Fleet 3-Node Cluster

We're going to extend the my previous post and combine it with CoreOS example deployment.

Here's my example cloud-config, but you'll need to customise it for you're own purpose.

Once you've created your cluster, you should verify that etcd is correctly setup and you can do that with etcdctl command.

$ etcdctl ls --recursive


Now that etcd is correctly setup, we can move onto fleet. Fleet uses etcd to communicate with the other nodes.
We need submit the 2 services to fleet.

$ fleetctl submit project.backend.@.service project-discovery.backend.@.service
$ fleetctl list-unit-files
project.backend...  xxxxxxx inactive inactive -
project-discovery...    yyyyyyy inactive inactive -

And to start the services in fleet:

$ fleetctl start project-discovery.backend.@{1..3}.service project.backend.@{1..3}.service
Unit project.backend.@1.service launched on 0e0a1f59.../
Unit project.backend.@2.service launched on 30a73182.../
Unit project-discovery.backend.@1.service launched on 0e0a1f59.../
Unit project-discovery.backend.@2.service launched on 30a73182.../
Unit project.backend.@3.service launched on 610a163d.../
Unit project-discovery.backend.@3.service launched on 610a163d.../

$ fleetctl list-units
UNIT                                   MACHINE                     ACTIVE  SUB
project.backend.@1.service             0e0a1f59.../    active  running
project.backend.@2.service             30a73182.../    active  running
project.backend.@3.service             610a163d.../    active  running
project-discovery.backend.@1.service   0e0a1f59.../    active  running
project-discovery.backend.@2.service   30a73182.../    active  running
project-discovery.backend.@3.service   610a163d.../    active  running

Now that fleet is running the services, any additional nodes you add to the same etcd network will pick up these services, but only 3 will run at any one time.

In the next post, I'll show you how to automatically take advantage of these nodes.

Tags: CoreOS, fleet, Etc

comments powered by Disqus