This post deals with setting up a 3-Cluster CoreOS installation using Vagrant and VirtualBox on Windows and CentOS. It is intended as a short practical introduction to using CoreOS. Later posts will show how to set up and connect different containers in CoreOS.
Why use CoreOS?
The new architecture of ePages will almost certainly be based on CoreOS as an operating system. CoreOS in combination with Docker, etcd, systemd or fleet fits perfectly into the microservices approach. It is designed to facilitate large multiple-machine deployments and is easy to scale and manage. CoreOS uses Linux containers to manage services instead of package managers. One of the main advantages is that the code and all dependencies of a single service, is packaged within a container and can be run on different CoreOS machines (see also Using CoreOs and CoreOS with Docker).
Now let’s just start with the practical stuff:
Windows
Prerequisites
1. Power Shell 3.0
First, install the Windows Management Framework 3.0 including the Windows PowerShell 3.0. The standard shell will have some troubles with paths. Download the latest version here.
2. Install cygwin
To get the rsync feature, install cygwin on your Windows installation. Download it here.
- Make sure to activate “rsync” and “SSH” in the installation.
- Add “C:\cygwin64\bin” to your Windows system variable “PATH”.
3. Install VirtualBox
Download the latest version of VirtualBox here.
4. Install Vagrant
Download the latest version of Vagrant here.
Getting started
1. Clone the CoreOs-Vagrant git repo
Make sure to use Git in Bash for this.
2. Start a cluster
We need to generate a unique token where etcd can find information on the nodes of the etcd cluster.
- Get the discovery token from https://discovery.etcd.io/new
- Edit the file
user-data
. Replacehttps://discovery.etcd.io/NEW_TOKEN
with the URL received above.
After replacing the link it should looks like this:
3. Start clusters
Now change to your PowerShell 3.0 and execute the following commands:
If everything works fine three VirtualBox windows appear and your shell should look like this:
4. Stop clusters
To stop the clusters execute the following commands in your PowerShell 3.0:
5. Increase cluster count
To increase the count of clusters, change the file config.rb
.
Let’s try to set up CoreOs with 10 clusters just for fun.
Change this:
to this:
Now switch to your PowerShell 3.0 and execute the following commands:
If everything works properly, you should see something like this:
6. Remove clusters
To completely remove the clusters, execute the following commands in PowerShell 3.0:
CentOS
Prerequisites
1. Install git
2. Install openssl-devel and openssl-devel
3. Install nano
4. Install Vagrant
5. Install VirtualBox
Insert the following text:
Save and exit vim.
Execute this:
Getting started
1. Clone the CoreOs-Vagrant git repo
Use Git in Bash for this.
2. Start a cluster
We need to generate a unique token where etcd can find information on the nodes of the etcd cluster.
- Get the discovery token from https://discovery.etcd.io/new
- Edit the file
user-data
. Replacehttps://discovery.etcd.io/NEW_TOKEN
with the URL received above.
After replacing the link it should looks like this:
3. Start clusters
4. Stop clusters
To stop the clusters, execute the following commands in PowerShell 3.0:
5. Increase cluster count
To increase the count of clusters, change the file config.rb
.
Let’s try to set up CoreOs with 10 clusters just for fun.
Change this:
to this:
Execute the following commands to start the clusters:
6. Remove clusters
To completely remove the clusters, execute following commands: