CoreOS is an interesting new Linux distribution that is taking a new approach to building out Internet scale infrastructure. From their website:
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. We've implemented them correctly so you don't have to endure the slow, learn-as-you-go infrastructure building process.
CoreOS can run on your existing hardware or on most cloud providers. Clustering works across platforms, making it easy to migrate parts of your gear over to CoreOS, or to switch cloud providers while running CoreOS.
Specifically, CoreOS features 3 characteristics that allow for manageable, yet large, scale-out systems.
- CoreOS is an OS that's designed to be a modern, minimal base to build your platform. It consumes 50% less RAM on boot than an average Linux installation and allows for very quick PXE/iPXE booting.
- Utilizes an active/passive dual-partition scheme to update the OS as a single unit instead of package by package. This makes each update quick, reliable and able to be easily rolled back.
- As a core architectural level, CoreOS runs applications as Docker containers. Containers provide maximum flexibility in packaging and can start in milliseconds.
This tutorial is going to walk through the steps to install a CoreOS cluster and provide the facilities to play with the distribution. Currently (as of this writing) the CenturyLink Cloud does not allow custom images to be uploaded and deployed. We are going to make use of the facts that a) OpenStack can run on the CenturyLink Cloud, and b) OpenStack provides the facilities to upload and run custom images. While obviously not a system you would put into production it allows CoreOS to be bootstrapped on the CenturyLink Cloud for exploration purposes.
To start with we need a running copy of OpenStack. Directions on how to set this up are here.
Create CoreOS project within OpenStack
We are going to create a new project within OpenStack to encapsulate and identify the CoreOS demo. After logging into the OpenStack Horizon dashboard, choose
_Identity_ and then
_Projects_. In the upper right of the screen select
_Create Project_ and give it the name CoreOS Demo.
After hitting the confirm you should see a screen that looks like:
Create OpenStack user
Next, we are going to create a unique user within OpenStack that is associated with this project. From the Horizon dashboard select
_Identity_ and then
_Users_. Again, in the upper right of the screen you will find the
_Create User_ button.
Add the new user CoreOSuser, give it an email address, and then enter for the password CoreOSuser (as an example). On the
_Primary Project_ selector choose the CoreOS Demo project that we just created. The
_Role_ should be assigned to admin.
After hitting confirm you should have a screen that looks like:
OK, we have now set up OpenStack in preparation to install and run CoreOS. Take a small coffee break and we will get onto the real fun!
Add environment variables (OS_USERNAME, OS_TENANT_ID, OS_PASSWORD, OS_AUTH_URL)
Move back to the SSH shell you have open. We will be interacting with the OpenStack CLI and in order to do this we need to set our credentials in the environment. Enter the following from the Linux shell:
$ export _OS_USERNAME="CoreOSuser"_ $ export _OS_PASSWORD="CoreOSuser"_
_Project ID_ for the
_CoreOS Demo_ project and enter it as the OS_TENANT_ID. You will find this on the Project page (as shown above). You need to make sure you enter the specific details for your setup (every installation will have unique Project identifiers).
$ export _OS_TENANT_ID="a5ded83545d24ac8bdec0cf86358d78d"_
Lastly, we need to tell OpenStack where to find the Keystone authorization service. From the Horizon dashboard go to
_Access & Security_, and select the
_API Access_. Your screen should look like:
_Service Endpoint_ for the
_Identity_ service and enter it as the OS_AUTH_URL. You need to make sure you enter the specific details for your setup (every installation will have unique service endpoints).
$ export _OS_AUTH_URL="http://10.120.85.12:5000/v2.0"_
OpenStack is now set up to host CoreOS as a supported image.
The general process will be to download the CoreOS image, import it into the OpenStack Glance image registry, and then launch instances based on this image... Pretty straigh-forward, right?
To download the CoreOS image enter the following from the Linux shell:
$ wget http://beta.release.core-os.net/amd64- usr/current/coreos_production_openstack_image.img.bz2 $ bunzip2 coreos_production_openstack_image.img.bz2
And install the image into Glance:
$ glance image-create --name CoreOS --container-format bare --disk-format qcow2 --file coreos_production_openstack_image.img --is-public True
On a successful completion of the import you will see a confirmation screen that looks similar to:
Note the id that was assigned to the image, this is what you will pass into Nova to launch instances of CoreOS. Finally, let's go ahead and launch 3 instances of CoreOS on our OpenStack over CenturyLink Cloud system. Again from the Linux command line enter:
nova boot --user-data ./cloud-config.yaml --image 279f1236-0286-4b01-b894-e44e484fac6a --flavor m1.medium --num-instances 3 --security-groups default coreos --config-drive=true
Nova will give you back a confirmation that looks like:
And finally, do a Nova list command to see our 3 CoreOS instances up and running, attached to a private network.
$ nova list
Now that you have a running CoreOS cluster you can start to experiment with all of the cool aspects of the system.