How to set up a CoreOS cluster on Ubuntu server

Index:


Step 1: Install Vagrant and VirtualBox (can be VMWare)
Step 2: Clone coreos-vagrant repository
Step 3: Config and start a cluster


Step 1: Install Vagrant and VirtualBox (can be VMWare)

CoreOS, Linux for Massive Server Deployments.

CoreOS is a new Linux distribution that has been re-architected to provide features needed to run modern infrastructure stacks. The strategies and architectures that influence CoreOS allow companies like Google, Facebook and Twitter to run their services at scale with high resilience.

First of all, let's download some virtualization providers to run CoreOS.We are going to use VirtualBox/Vagrant to virtualize your cluster.


Type this to start:
$ sudo apt-get update && sudo apt-get dist-upgrade -y
if, you are under a corporative proxy, you may not have connection to internet, so make sure your proxy is well configured.


VirtualBox



After install VirtualBox let's make sure we have configure our apt sources list to be able to download VirtualBox latest version.

Type:

$ sudo vim /etc/apt/sources.list

Add one of the following lines according to your distribution to your /etc/apt/sources.list: at the end of the text.

Note: type letter " i " to edit

deb http://download.virtualbox.org/virtualbox/debian trusty contrib 
deb http://download.virtualbox.org/virtualbox/debian saucy contrib 
deb http://download.virtualbox.org/virtualbox/debian raring contrib 
deb http://download.virtualbox.org/virtualbox/debian quantal contrib 
deb http://download.virtualbox.org/virtualbox/debian precise contrib 
deb http://download.virtualbox.org/virtualbox/debian lucid contrib non-free 
deb http://download.virtualbox.org/virtualbox/debian wheezy contrib 
deb http://download.virtualbox.org/virtualbox/debian squeeze contrib non-free

Then save.
Note: press ":wq" then "enter" w: write, q: quit

The Oracle public key for apt-secure can be downloaded and set it with the following command:

$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

To install VirtualBox:
$ sudo apt-get update && sudo apt-get install virtualbox-4.3

Note: Ubuntu/Debian users might want to install the dkms package to ensure that the VirtualBox host kernel modules (vboxdrv, vboxnetflt and vboxnetadp) are properly updated if the linux kernel version changes during the next apt-get upgrade. For Debian it is available in Lenny backports and in the normal repository for Squeeze and later. The dkms package can be installed through the Synaptic Package manager or through the following command:

$ sudo apt-get install dkms

This is the same as the steps above, let's say "the short answers"
$ echo "deb http://download.virtualbox.org/virtualbox/debian trusty contrib" | sudo tee -a /etc/apt/sources.list > /dev/null wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - 
$ sudo apt-get update 
$ sudo apt-get install linux-headers-3.13.0-35-generic -y 
$ sudo apt-get install virtualbox-4.3 -y 
$ sudo /etc/init.d/vboxdrv setup

Then we should reboot our server
$ sudo reboot


Vagrant



There are install packages available for Windows, Linux and OSX. Find the latest installer on the Vagrant downloads page. Be sure to get version 1.6.3 or greater.

Just type:

$ wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.1_x86_64.deb

$ sudo dpkg --install vagrant_1.7.1_x86_64.deb

for 32 bits
$ wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.1_i686.deb
$ sudo dpkg --install vagrant_1.7.1_i686.deb

That is going to take a few minutes. Once the process had finished, you should be able to run the Vagrant and VirtualBox binaries.

Let's try them:

$ vboxmanage -v && vagrant --version

Make sure you have the correct version for each:

  • VirtualBox 4.3 or greater
  • Vagrant 1.6.3 or greater

Step 2: Clone coreos-vagrant repository


Let's try them:
$ sudo git clone https://github.com/coreos/coreos-vagrant.git
$ cd coreos-vagrant


Step 3: Config and start a cluster


user-data.sample


CoreOS allows you to configure machine parameters, launch systemd units on start-up and more via cloud-config. Jump over to the docs to learn about the supported features. You can provide cloud-config data to your CoreOS Vagrant VM by editing the user-data file inside of the cloned directory. A sample file user-data.sample exists as a base and must be renamed to user-data for it to be processed.

If you need to update your cloud-config later on, run vagrant reload --provision to reboot your VM and apply the new file.

config.rb.sample


The config.rb.sample file contains a few useful settings about your Vagrant environment and most importantly, how many machines you'd like in your cluster.

CoreOS is designed to be updated automatically with different schedules per channel. Select the channel you'd like to use for this cluster below:


Stable

The Stable channel should be used by production clusters. Versions of CoreOS are battle-tested within the Beta and Alpha channels before being promoted. Current version is CoreOS 494.5.0.

Rename the file to config.rb then uncomment and modify:


config.rb
# Size of the CoreOS cluster created by Vagrant
$num_instances=3
# Official CoreOS channel from which updates should be downloaded
$update_channel='stable'


Beta

The beta channel consists of promoted alpha releases. Current version is CoreOS 522.2.0.
Rename the file to config.rb then uncomment and modify:


config.rb
# Size of the CoreOS cluster created by Vagrant
$num_instances=3
# Official CoreOS channel from which updates should be downloaded
$update_channel='beta'


Alpha


The alpha channel closely tracks master and is released to frequently. The newest versions of docker, etcd and fleet will be available for testing. Current version is CoreOS 540.0.0.

Rename the file to config.rb and modify a few lines:

config.rb
# Size of the CoreOS cluster created by Vagrant
$num_instances=3
# Official CoreOS channel from which updates should be downloaded
$update_channel='alpha'


Start Machines Using Vagrant's default VirtualBox Provider


Start the machine(s):
$ sudo vagrant up
List the status of the running machines:
$ sudo vagrant status
Connect to one of the machines:
$ sudo vagrant ssh core-01 -A

If you can't connect to the virtual machines, you may have not configure the 64-bit virtualization extensions. To turn on this option try this:

On bare metal:
  1. Press LEFT-SHIFT to enter to BIOS
  2. Look for "enabiling 64-bit virtualization" or look for "VT-x", they are the same thing.
  3. Reboot
On VMWare:

  1. Power off vmware vitrual machine.
  2. Go to "edit virtual machine settings"
  3. Go to processors. There are three checkboxes there.
  4. Check second checkbox (enable VT-x/AMD-V)
  5. Power on machine.
On VirtualBox:
  1. Power off VB vitrual machine.
  2. Go to "edit virtual machine settings"
  3. Go to system. There are three tabs there.
  4. Go to acceleration tab then (enable VT-x/AMD-V)
  5. Power on machine.

Start Machines Using Vagrant's VMware Provider

If you have purchased the VMware Vagrant provider, run the following commands:
$ sudo vagrant up --provider vmware_fusion
$ sudo vagrant ssh core-01 -A


And that's it !

Cheers :)


Comments

Popular posts from this blog

Configurar y desplegar una Web API en Azure App Service Environment

Patrones de diseño para aplicaciones de alta disponibilidad en Azure - Resilient Applications (Parte I: Retry Policy)

Integrar Web API de .NET en proyecto de Xamarin.Forms utilizando Visual Studio y Azure API App

Conectar .NET Web API con Azure API Management

Publicar resultados de una consulta de Azure SQL Database a Azure Service Bus con Logic App