O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning CoreOS

Book Description

Your one-stop guide for building, configuring, maintaining, and deploying one of the world's fastest growing OSes

About This Book

  • Understand the features of CoreOS and learn to administrate and secure a CoreOS environment
  • Develop, test, and deploy cloud services and applications more quickly and efficiently inside lightweight containers using CoreOS
  • This is a complete tutorial on CoreOS, which is the preferred OS for cloud computing as it contains components that facilitate cloud management

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 micro-services 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.

What You Will Learn

  • Understand the benefits of CoreOS as a cloud orchestration platform
  • Learn about lightweight containers and various container frameworks such as Docker and RKT in CoreOS
  • Manage services and containers across cluster using Fleet and systemd
  • Set up a CoreOS environment using Vagrant
  • Create and manage CoreOS clusters
  • Discover the service parameters using etcd
  • Find out about chaining services running on the cluster using Flannel / Rudder and Weave
  • Create a virtual tenant network and service chaining using OVS

In Detail

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.

Style and approach

This practical guide covers the basics and advanced topics related to CoreOS and lightweight containers. The topics are covered in an easy-to-follow manner with each feature explained in detail, beginning with a brief overview and followed by an explanation of its corresponding configuration files.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Learning CoreOS
    1. Table of Contents
    2. Learning CoreOS
    3. Credits
    4. About the Authors
    5. About the Reviewer
    6. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the color images of this book
        2. Errata
        3. Piracy
        4. Questions
    8. 1. CoreOS, Yet Another Linux Distro?
      1. Introduction to CoreOS
      2. CoreOS versus other Linux distributions
      3. CoreOS high-level architecture
        1. Service discovery
          1. etcd
        2. Container management
          1. Linux Container
            1. cgroups
            2. Namespace
            3. Chroot
          2. Docker
          3. Docker versus LXC
          4. Rocket
        3. CoreOS cluster management:
          1. systemd
          2. fleet
      4. CoreOS and OpenStack
      5. Summary
    9. 2. Setting Up Your CoreOS Environment
      1. Installing GIT
      2. Installing VirtualBox
      3. Introduction to Vagrant
        1. Installing Vagrant
        2. Vagrant configuration files
        3. Cloud-config
        4. The config.rb configuration file
        5. Starting a CoreOS VM using Vagrant
      4. Setting up CoreOS on VMware vSphere
      5. Installing VMware vSphere Client
      6. Introduction to Docker
        1. Image
        2. Container
          1. Volumes
        3. Links
        4. Installing Docker
        5. Creating a sample Docker image using Docker File
          1. Docker File
        6. Pulling the Docker image from Docker Hub
        7. Running Docker Image
      7. Summary
    10. 3. Creating Your CoreOS Cluster and Managing the Cluster
      1. Introduction to clustering
      2. The why and the benefits of clustering
      3. CoreOS clustering
        1. Cluster discovery
        2. Static discovery
        3. etcd discovery
        4. DNS discovery
          1. systemd
        5. Service unit files
        6. Starting and stopping a service
          1. fleet
        7. Architectural overview
          1. Engine
          2. Agent
        8. fleetctl
          1. Standard (local) and global units
        9. Unit file options for fleet
        10. Instantiating the service unit in the cluster
        11. Recovering from node failure
      4. Summary
    11. 4. Managing Services with User-Defined Constraints
      1. Introduction to service constraints
      2. Predefined constraints using metadata
        1. Service level affinity/anti-affinity
        2. Node-level affinity
        3. High availability
      3. Summary
    12. 5. Discovering Services Running in a Cluster
      1. Introduction and necessity of service discovery
      2. Mechanism for service discovery
        1. Operations of etcd
          1. Operations using etcdctl
            1. etcd write using etcdctl
            2. etcd read using etcdctl
            3. etcd watch using etcdctl
            4. Example of etcd using etcdctl
          2. Operations using cURL
            1. etcd read using curl
            2. etcd write using curl
            3. etcd watch using curl
            4. Example using curl
      3. HAProxy and service discovery
      4. Summary
    13. 6. Service Chaining and Networking Across Services
      1. Introduction to and necessity of service chaining
      2. Introduction to Docker networking
        1. Container–Container communication
          1. Docker0 bridge and veth pair
          2. Using Link
          3. Using common network stack
        2. Container to CoreOS host communication
          1. Host networking
          2. docker0 bridge
        3. Container to CoreOS outside world communication
          1. Host networking
          2. Port mapping
        4. Container – Container communication in different CoreOS nodes
      3. Introduction to Weave
      4. Introduction to Flannel/Rudder
        1. Installation
        2. Setting up Weave
        3. Container startup
      5. Integrating Flannel with CoreOS
      6. Summary
    14. 7. Creating a Virtual Tenant Network and Service Chaining Using OVS
      1. Introduction to OVS
        1. OVS architectural overview
        2. Advantages of using OVS in CoreOS
      2. Introduction to overlay and underlay networks
      3. Introduction to network virtualization
        1. OpenFlow support in OVS
          1. OpenFlow switch
          2. OpenFlow controller
          3. OpenFlow channel
      4. Running OVS in CoreOS
        1. Attaching docker0 bridge to OVS
          1. Configuration in CoreOS Instance 1
            1. Configurations during the instantiation of a CoreOS node 1 in a cluster
            2. Configurations during the creation of a container for CoreOS Instance 1
          2. Configuration in CoreOS Instance 2
            1. Configurations during the instantiation of CoreOS node 2 in a cluster
            2. Configurations during the creation of a container for CoreOS Instance 2
        2. Attaching container's veth interface to OVS
          1. Configuration in CoreOS Instance 1
            1. Configurations during the instantiation of a CoreOS node in a cluster
            2. Configurations during the creation of the first container for a tenant
            3. Configurations during the creation of subsequent containers for a tenant
          2. Configuration in CoreOS Instance 2
            1. Configurations during the instantiation of a CoreOS node in a cluster
            2. Configurations during the creation of the first container for a tenant
            3. Configurations during the creation of subsequent containers for a tenant
          3. Looping issue
      5. Summary
    15. 8. What Next?
      1. Container security
      2. Update and patches – CoreUpdate
      3. Dex
      4. sysdig
      5. Competitive container orchestration mechanism
        1. Kubernetes
          1. Kubernetes master
          2. Kubernetes nodes
          3. Kubernetes pods
          4. Kubernetes service
        2. CoreOS and Kubernetes
      6. Apache-Mesos
        1. Mesos master
        2. Mesos agent
        3. ZooKeeper
        4. Mesos frameworks
      7. Swarm
      8. Docker data volume management
        1. Introduction to Flocker
          1. Flocker control services
          2. Flocker agents
          3. Flocker plugin for Docker
      9. Open Container Project
      10. Summary
    16. Index