Book Image

Learning CoreOS

By : Kingston Smiler. S, Shantanu Agrawal
Book Image

Learning CoreOS

By: Kingston Smiler. S, Shantanu Agrawal

Overview of this book

CoreOS is an open source operating system developed upon the Linux kernel. The rise of CoreOS is directly related to the rise of Docker (a Linux container management system). It is a minimal operating system layer and takes a different approach to automating the deployment of containers. The major difference between CoreOS and other Linux distributions is that CoreOS was designed to deploy hundreds of servers. CoreOS immensely helps the users to create systems, which are easy to scale and manage, making life easier for all, be it developer, QA, or deployer. This book is all about setting up, deploying, and using CoreOS to manage clusters and clouds. It will help you understand what CoreOS is and its benefits as a cloud orchestration platform. First, we’ll show you how to set up a simple CoreOS instance with single node in the cluster and how to run a Docker container inside the CoreOS instance. Next, you’ll be introduced to Fleet and systemd, and will deploy and distribute Docker services across different nodes in cluster using Fleet. Later, you’ll be briefed about running services in a cluster with constraints, publishing the services already running on the cluster to new services, and making your services interact with each other. We conclude by teaching you about advanced container networking. By the end of the book, you will know the salient features of CoreOS and will be able to deploy, administrate, and secure a CoreOS environment.
Table of Contents (15 chapters)
Learning CoreOS
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Preface

As more and more applications are moving towards the cloud with server virtualization, there is a clear necessity to deploy the user applications and services very fast and make them reliable with assured SLA by deploying the services in a right set of servers. This becomes more complex when these services are dynamic in nature, which results in making these services autoprovisioned and autoscaled over a set of nodes. The orchestration of the user application is not limited to deploy the services in the right set of server or virtual machines rather to be extended to provide network connectivity across these services to provide Infrastructure as a Service (IaaS). Compute, network, and storage are the three main resources to be managed by the cloud provider in order to provide (IaaS). Currently, there are various mechanisms to handle these requirements in more abstract fashion. There are multiple cloud orchestration frameworks, which can manage the compute, storage, and networking resources. OpenStack, Cloud Stack, and VMware vSphere are some of the cloud platforms that orchestrate these resource pools and provide IaaS.

The server virtualization provided by a Virtual Machine (VM) has its own overhead of running a separate instance of the operating system on every virtual machine. This brings down the number of VM instances that can be run on the server, which heavily impacts the operational expense. As Linux namespace, containers technologies, such as docker and rkt, are gaining its popularity; one more level of server virtualization can be introduced by deploying the application services inside a container rather than VM However, there is a necessity of an orchestration and clustering framework for the containers or dockers for deploying the services in the cluster, the discovery of the service and service parameters, providing network across these containers or dockers, and so on. CoreOS is developed for this purpose.

CoreOS is a light-weight cloud service orchestration operating system based on Google Chrome. CoreOS is developed primarily for orchestrating applications/services over a cluster of nodes. CoreOS extends the existing services provided by Linux to work for a distributed cluster and not limited to a single node.

What this book covers

Chapter 1, CoreOS, Yet Another Linux Distro?, explains the basics of containers, dockers, and high-level architecture of CoreOS.

Chapter 2, Setting Up Your CoreOS Environment, teaches you how to set up and run CoreOS with a single machine using Vagrant and VirtualBox. It also covers how to create and run docker images and get familiarized with the important configuration files and their contents.

Chapter 3, Creating Your CoreOS Cluster and Managing the Cluster, teaches you how to set up the CoreOS cluster with multiple machines. You will also learn how machines are discovered and services are scheduled on those machines. Also, you will learn about starting and stopping a service using Fleet.

Chapter 4, Managing Services with User-Defined Constraints, gives an introduction about service constraints, which helps to deploy services on suitable members.

Chapter 5, Discovering Services Running in Cluster, explains the need and mechanism for the discovery of services running on a cluster. Also, you will learn about two important tools, which are used widely for service discovery: etcdctl and curl.

Chapter 6, Service Chaining and Networking Across Services, explains the importance of the container communications and the various possibilities provided by CoreOS and docker to provide the communication.

Chapter 7, Creating a Virtual Tenant Network and Service Chaining Using OVS, explains the importance of OVS in container communications and the various advantages provided by OVS. The chapter details how the services deployed by different customers/tenants across the CoreOS cluster can be linked/connected using OVS.

Chapter 8, What Next?, touches upon some advanced Docker and Core OS topics and also discusses about what is coming up in CoreOS.

Who this book is for

This book is for cloud or enterprise administrators and application developers who would like to gain knowledge about CoreOS to deploy a cloud application or microservices on a cluster of cloud servers. It is also aimed at administrators with basic networking experience. You do not need to have any knowledge of CoreOS.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "A directory, coreos-vagrant, is created after git clone."

A block of code is set as follows:

[Unit]
Description=Example
After=docker.service
Requires=docker.service

[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill busybox1
ExecStartPre=-/usr/bin/docker rm busybox1
ExecStartPre=/usr/bin/docker pull busybox
ExecStart=/usr/bin/docker run --name busybox1 busybox /bin/sh -c "while true; do echo Hello World; sleep 1; done"
ExecStop=/usr/bin/docker stop busybox1

Any command-line input or output is written as follows:

weave status
...
        Service: dns
         Domain: weave.local.
       Upstream: 10.0.2.3
            TTL: 1
        Entries: 2

        Service: proxy
        Address: unix:///var/run/weave/weave.sock

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Click on Datastore ISO File and select the uploaded iso file from the data store."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/LearningCoreOS_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.