VirtualBox CoreOS cluster

“CoreOS is a new Linux distribution that has been rearchitected to provide features needed to run modern infrastructure stacks.”

That’s geek-speak for a Linux distribution that makes it (not-so-) super easy to run fun things like Linux containers and containerized applications on commodity hardware. That’s one of the trending things in the business, and it’s the kind of stuff I love to play it, even if just for the heck of it.

CoreOS just makes it easy to set up such systems, though it is not the only solution. CoreOS is derived from Chrome OS, with added functionality for server- and cluster-type installations.

To use CoreOS, you need to have VirtualBox and Vagrant installed. Other virtualization technologies are also supported, but the combination of VirtualBox and Vagrant seems, to me, to be the easiest to set up. Since I’m running Fedora 20, which has the latest version of VirtualBox in its repository, all I needed to install it, was type: yum install VirtualBox. To install Vagrant, download the RPM file from here. You can either save it to the Downloads directory and install it using yum from the command line, or open it in Apper, the graphical package manager, which will do the installation for you.

With those two installed, time to install (git clone) CoreOS itself, a task that has to be completed from the command line. So fire up a shell terminal, and also be sure to start VirtualBox. Then, type: git clone https://github.com/coreos/coreos-vagrant.git. After that, there should be a coreos-vagrant directory. Change into that directory (cd coreos-vagrant). An ls of that directory should show four files. Two of them should be named user-data.sample and config.rb.sample. Copies of tThose two will have to be modified a bit before the cluster is created.

Related Post:  WireGuard: Great piece of software or not so much?

Make a copy of user-data.sample and name it user-data (cp user-data.sample user-data). For the other file, name its copy config.rb (cp config.rb.sample config.rb). Open config.rb (nano -w config.rb) and look for the line that reads: #$num_instances=1. Uncomment it and change 1 to 3 so that it reads: $num_instances=3. That just defines the number of members in the cluster. Optionally, you may also uncomment the line that reads: #$vb_gui = false to $vb_gui = true. Making that change will just ensure that when the cluster is started, each member will have a graphical VirtualBox interface started. Not necessary, but it won’t break anything.

Then, open user-data (nano -w user-data and uncomment the #discovery: https://discovery.etcd.io/ line, so that it reads: discovery: https://discovery.etcd.io/. You will have to replace the part of that URL with a real token, which you can generate from https://discovery.etcd.io/new. That URL is the etcd discovery URL that’s used to start the cluster and elect an etcd leader. etcd is a “highly-available key value store for shared configuration and service discovery.” etcd and fleet, a distributed init system, are two services used to start and manage a CoreOS cluster. Fleet is a cluster-level version of systemd.

After generating the token, replace the in the discovery URL with the real token, so that it reads something like: discovery: https://discovery.etcd.io/9b090745ad1f48344e8fd004a293067c. With all that out of the way and assuming that you’re still in the coreos-vagrant directory, bring up the cluster by typing: vagrant up. You should see messages of the sort shown in this screenshot as each member of the cluster is created.
CoreOS vagrant create cluster

Related Post:  How to access your Windows 10 files from Linux on a dual-boot system

As each member is created, you should also see a VirtualBox interface open. By default, you will not be able to do anything through them, since logging in is via SSH private keys. However, if you create a user and set a password, you will be able to log in via the VirtualBox interface, though that is really not necessary.
CoreOS VirtualBox cluster members

After creation of the cluster has been completed, you may type: vagrant ssh-config to see the SSH configuration details for each member. To log into any member, type: vagrant ssh , where is the hostname of a cluster member. So in the example shown in this screenshot, I logged into the first member using: vagrant ssh core-01
CoreOS cluster members

In VirtualBox, you see each member listed, just like on this screenshot.
VirtualBox CoreOS cluster

If you have gone this far, what you have just created is really an empty cluster set, where each member is like a minimal installation of your favorite Linux distribution. So play around with your cluster, become familiar with the vagrant commands; type vagrant -h to see the list of available commands. Inside a cluster member, become familiar with the etcdctl and fleetctl management utilities. To bring down the cluster, type: vagrant halt. Next: How to transform each cluster member into a complete Linux distribution. Stay tuned.

Share:

Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on linkedin
LinkedIn

Hola! Did you notice that LinuxBSDos.com no longer runs network ads?  Yep, no more ads from the usual suspects that track you across the Internet.  But since  I still need to pay to keep the site running, feel free to make a small donation by PayPal.

Subscribe for updates. Trust me, no spam!

Mailchimp Signup Form

Sponsored links

1. Attend Algorithm Conference, a top AI and ML event for 2020.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest

On social media
Via my newsletter
Mailchimp Signup Form

Sponsored links

1. Attend Algorithm Conference, a top AI and ML event for 2020.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.
Hacking, pentesting distributions

Linux Distributions for Hacking

Experts use these Linux distributions for hacking, digital forensics, and pentesting.

Categories
Archives

The authors of these books are confirmed to speak during

Algorithm Conference

T-minus AI

Author was the first chairperson of AI for the U.S. Air Force.

The case for killer robots

Author is the Director of the Center for Natural and Artificial Intelligence.

Why greatness cannot be planned

Author works on AI safety as a Senior Research Scientist at Uber AI Labs.

Anastasia Marchenkova

An invitation from Anastasia Marchenkova

Hya, after stints as a quantum researcher at Georgia Tech Quantum Optics & Quantum Telecom Lab, and the University of Maryland Joint Quantum Institute, I’m now working on superconducting qubit quantum processors at Bleximo. I’ll be speaking during Algorithm Conference in Austin, Texas, July 16 – 18, 2020. Meet me there and let’s chat about progress and hype in quantum computing.