After I’ve set up my DigitalOcean environment, I show how to launch a CoreOS cluster on it. To remain as relevant to productive experience as possible, I decided to run a Testing Cluster as described in the CoreOS documentation.
The first droplet is my etcd machine. Basically it runs a single etcd service, which is used as backend for fleet on all machines of my cluster. It was created with the following user-data:
The exposed docker socket is not relevant for our cluster to function. I just used it to test docker images before deploying them to the whole cluster.
After the etcd droplet is running, fleetctl shows one machine with role=service as metadata. The metadata is used by fleet to decide, where clustered services should be started. I use role to distinguish between the one services machine and all other worker machines.
1 2 3
$ fleetctl list-machines MACHINE IP METADATA cfb065fa... 46.101.xxx.xxx disk=ssd,platform=digitalocean,role=services
To create the worker machines I need to know the IP of the etcd droplet just created and insert it in the user-data of the workers. With that, workers can be created as many as I like, using the following user-data:
Instead of running etcd on every worker, I configured fleet to use the one from my etcd droplet. The setup-etcdctl-env.service makes it possible to use the etcdctl command from within fleet unit files, which I’ll describe in the next post.
To do failover testing with fleet I needed at least two workers.