DevOps: Puppet, Docker, and Kubernetes

Book description

Get hands-on recipes to automate and manage Linux containers with the Docker 1.6 environment and jump-start your Puppet development

About This Book

  • Successfully deploy DevOps with proven solutions and recipes

  • Automate your infrastructure with Puppet and combine powerful DevOps methods

  • Deploy and manage highly scalable applications using Kubernetes

  • streamline the way you manage your applications

  • Who This Book Is For

    This Learning Path is for developers, system administrators, and DevOps engineers who want to use Puppet, Docker, and Kubernetes in their development, QA, or production environments. This Learning Path assumes experience with Linux administration and requires some experience with command-line usage and basic text file editing.

    What You Will Learn

  • Discover how to build high availability Kubernetes clusters

  • Deal with inherent issues with container virtualization and container concepts

  • Create services with Docker to enable the swift development and deployment of applications

  • Make optimum use of Docker in a testing environment

  • Create efficient manifests to streamline your deployments

  • Automate Puppet master deployment using Git hooks, r10k, and PuppetDB

  • In Detail

    With so many IT management and DevOps tools on the market, both open source and commercial, it’s difficult to know where to start. DevOps is incredibly powerful when implemented correctly, and here’s how to get it done.This Learning Path covers three broad areas: Puppet, Docker, and Kubernetes. This Learning Path is a large resource of recipes to ease your daily DevOps tasks. We begin with recipes that help you develop a complete and expert understanding of Puppet’s latest and most advanced features. Then we provide recipes that help you efficiently work with the Docker environment. Finally, we show you how to better manage containers in different scenarios in production using Kubernetes.

    This course is based on these books:

  • Puppet Cookbook, Third Edition

  • Docker Cookbook

  • Kubernetes Cookbook

  • Style and approach

    This easy-to-follow tutorial-style guide teaches you precisely how to configure complex systems in Puppet and manage your containers using Kubernetes.

    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. DevOps: Puppet, Docker, and Kubernetes
      1. Table of Contents
      2. DevOps: Puppet, Docker, and Kubernetes
      3. Credits
      4. Preface
        1. What this learning path covers
        2. What you need for this learning path
        3. Who this learning path is for
        4. Reader feedback
        5. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      5. 1. Module 1
        1. 1. Puppet Language and Style
          1. Introduction
          2. Adding a resource to a node
            1. How to do it...
            2. How it works...
          3. Using Facter to describe a node
            1. How to do it...
            2. How it works...
            3. There's more...
              1. Variables
              2. Scope
          4. Installing a package before starting a service
            1. How to do it...
            2. How it works...
              1. Capitalization
              2. Learning metaparameters and ordering
              3. Trifecta
              4. Idempotency
          5. Installing, configuring, and starting a service
            1. How to do it...
            2. How it works…
          6. Using community Puppet style
            1. How to do it…
              1. Indentation
              2. Quoting
              3. False
              4. Variables
              5. Parameters
              6. Symlinks
          7. Creating a manifest
            1. How to do it...
            2. There's more…
          8. Checking your manifests with Puppet-lint
            1. Getting ready
            2. How to do it...
            3. There's more...
            4. See also
          9. Using modules
            1. How to do it…
            2. How it works…
            3. There's more…
              1. Templates
              2. Facts, functions, types, and providers
            4. Third-party modules
              1. Module organization
            5. See also
          10. Using standard naming conventions
            1. How to do it…
            2. There's more…
          11. Using inline templates
            1. How to do it…
            2. How it works…
            3. There's more...
            4. See also
          12. Iterating over multiple items
            1. How to do it…
            2. How it works…
            3. There's more…
              1. Using hashes
              2. Creating arrays with the split function
          13. Writing powerful conditional statements
            1. How to do it…
            2. How it works…
            3. There's more…
              1. Elseif branches
              2. Comparisons
              3. Combining expressions
            4. See also
          14. Using regular expressions in if statements
            1. How to do it…
            2. How it works…
            3. There's more…
              1. Capturing patterns
              2. Regular expression syntax
            4. See also
          15. Using selectors and case statements
            1. How to do it…
            2. How it works…
              1. Selector
              2. Case statement
            3. There's more…
              1. Regular expressions
              2. Defaults
          16. Using the in operator
            1. How to do it…
            2. There's more…
          17. Using regular expression substitutions
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          18. Using the future parser
            1. Getting ready
            2. How to do it...
              1. Appending to and concatenating arrays
              2. Lambda functions
                1. Reduce
                2. Filter
                3. Map
                4. Slice
                5. Each
                6. Other features
        2. 2. Puppet Infrastructure
          1. Introduction
          2. Installing Puppet
            1. Getting ready
            2. How to do it...
          3. Managing your manifests with Git
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
          4. Creating a decentralized Puppet architecture
            1. Getting ready
            2. How to do it...
            3. How it works...
          5. Writing a papply script
            1. How to do it...
            2. How it works...
          6. Running Puppet from cron
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
          7. Bootstrapping Puppet with bash
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
          8. Creating a centralized Puppet infrastructure
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
          9. Creating certificates with multiple DNS names
            1. Getting ready
            2. How to do it...
            3. How it works...
          10. Running Puppet from passenger
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
          11. Setting up the environment
            1. Getting ready
            2. How to do it...
            3. There's more...
          12. Configuring PuppetDB
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
          13. Configuring Hiera
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
          14. Setting node-specific data with Hiera
            1. Getting ready
            2. How to do it...
            3. How it works...
          15. Storing secret data with hiera-gpg
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
            5. See also
          16. Using MessagePack serialization
            1. Getting ready
            2. How to do it...
            3. How it works...
          17. Automatic syntax checking with Git hooks
            1. How to do it...
            2. How it works...
          18. Pushing code around with Git
            1. Getting ready
            2. How to do it...
            3. How it works...
          19. Managing Environments with Git
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
        3. 3. Writing Better Manifests
          1. Introduction
          2. Using arrays of resources
            1. How to do it…
            2. How it works…
            3. See also
          3. Using resource defaults
            1. How to do it...
            2. How it works...
            3. There's more...
          4. Using defined types
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          5. Using tags
            1. How to do it...
            2. There's more…
          6. Using run stages
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          7. Using roles and profiles
            1. How to do it…
            2. How it works…
            3. There's more…
          8. Passing parameters to classes
            1. How to do it…
            2. How it works…
            3. There's more…
              1. Specifying default values
          9. Passing parameters from Hiera
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
          10. Writing reusable, cross-platform manifests
            1. How to do it…
            2. How it works...
            3. There's more…
            4. See also
          11. Getting information about the environment
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          12. Importing dynamic information
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          13. Passing arguments to shell commands
            1. How to do it…
            2. How it works…
        4. 4. Working with Files and Packages
          1. Introduction
          2. Making quick edits to config files
            1. Getting ready
            2. How to do it...
            3. How it works…
            4. There's more…
          3. Editing INI style files with puppetlabs-inifile
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
          4. Using Augeas to reliably edit config files
            1. How to do it…
            2. How it works…
            3. There's more…
          5. Building config files using snippets
            1. Getting ready
            2. How to do it...
            3. How it works...
          6. Using ERB templates
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          7. Using array iteration in templates
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          8. Using EPP templates
            1. How to do it...
            2. How it works...
            3. There's more...
          9. Using GnuPG to encrypt secrets
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
            5. See also
          10. Installing packages from a third-party repository
            1. How to do it…
            2. How it works…
            3. There's more...
          11. Comparing package versions
            1. How to do it…
            2. How it works…
        5. 5. Users and Virtual Resources
          1. Introduction
          2. Using virtual resources
            1. How to do it...
            2. How it works...
            3. There's more...
          3. Managing users with virtual resources
            1. How to do it...
            2. How it works...
            3. There's more...
            4. See also
          4. Managing users' SSH access
            1. How to do it...
            2. How it works...
            3. There's more...
          5. Managing users' customization files
            1. How to do it...
            2. How it works...
            3. There's more...
            4. See also
          6. Using exported resources
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
        6. 6. Managing Resources and Files
          1. Introduction
          2. Distributing cron jobs efficiently
            1. How to do it...
            2. How it works...
            3. There's more...
            4. See also
          3. Scheduling when resources are applied
            1. How to do it...
            2. How it works...
            3. There's more...
          4. Using host resources
            1. How to do it...
            2. How it works...
            3. There's more...
          5. Using exported host resources
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
          6. Using multiple file sources
            1. How to do it...
            2. How it works...
            3. There's more...
            4. See also
          7. Distributing and merging directory trees
            1. How to do it...
            2. How it works...
            3. There's more...
          8. Cleaning up old files
            1. How to do it...
            2. How it works...
            3. There's more...
          9. Auditing resources
            1. How to do it...
            2. How it works...
            3. There's more...
            4. See also
          10. Temporarily disabling resources
            1. How to do it...
            2. How it works...
        7. 7. Managing Applications
          1. Introduction
          2. Using public modules
            1. How to do it...
            2. How it works...
            3. There's more...
          3. Managing Apache servers
            1. How to do it...
            2. How it works...
          4. Creating Apache virtual hosts
            1. How to do it...
            2. How it works...
            3. There's more...
          5. Creating nginx virtual hosts
            1. How to do it...
            2. How it works...
            3. There's more...
          6. Managing MySQL
            1. How to do it...
            2. How it works...
            3. There's more...
          7. Creating databases and users
            1. How to do it...
            2. How it works...
            3. There's more...
        8. 8. Internode Coordination
          1. Introduction
          2. Managing firewalls with iptables
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
          3. Building high-availability services using Heartbeat
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more...
          4. Managing NFS servers and file shares
            1. How to do it...
            2. How it works…
          5. Using HAProxy to load-balance multiple web servers
            1. How to do it…
            2. How it works…
            3. There's more...
          6. Managing Docker with Puppet
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
        9. 9. External Tools and the Puppet Ecosystem
          1. Introduction
          2. Creating custom facts
            1. How to do it...
            2. How it works...
            3. There's more...
            4. See also
          3. Adding external facts
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
              1. Debugging external facts
              2. Using external facts in Puppet
            5. See also
          4. Setting facts as environment variables
            1. How to do it...
          5. Generating manifests with the Puppet resource command
            1. How to do it...
            2. There's more...
          6. Generating manifests with other tools
            1. Getting ready
            2. How to do it...
            3. There's more...
          7. Using an external node classifier
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
            5. See also
          8. Creating your own resource types
            1. How to do it...
            2. How it works...
            3. There's more...
              1. Documentation
              2. Validation
          9. Creating your own providers
            1. How to do it...
            2. How it works...
            3. There's more...
          10. Creating custom functions
            1. How to do it...
            2. How it works...
            3. There's more...
          11. Testing your puppet manifests with rspec-puppet
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
            5. See also
          12. Using librarian-puppet
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
          13. Using r10k
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
        10. 10. Monitoring, Reporting, and Troubleshooting
          1. Introduction
          2. Noop – the don't change anything option
            1. How to do it...
            2. How it works...
            3. There's more...
            4. See also
          3. Logging command output
            1. How to do it...
            2. How it works...
            3. There's more...
          4. Logging debug messages
            1. How to do it...
            2. How it works...
            3. There's more...
              1. Printing out variable values
              2. Resource ordering
          5. Generating reports
            1. How to do it...
            2. How it works...
            3. There's more...
              1. Other report types
            4. See also
          6. Producing automatic HTML documentation
            1. How to do it...
            2. How it works...
            3. There's more...
          7. Drawing dependency graphs
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
            5. See also
          8. Understanding Puppet errors
            1. How to do it...
            2. See also
          9. Inspecting configuration settings
            1. How to do it...
            2. How it works...
            3. See also
      6. 2. Module 2
        1. 1. Introduction and Installation
          1. Introduction
            1. Namespaces
              1. The pid namespace
              2. The net namespace
              3. The ipc namespace
              4. The mnt namespace
              5. The uts namespace
              6. The user namespace
            2. Cgroups
            3. The Union filesystem
          2. Verifying the requirements for Docker installation
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          3. Installing Docker
            1. Getting ready
            2. How to do it…
            3. How it works...
            4. There's more…
            5. See also
          4. Pulling an image and running a container
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          5. Adding a nonroot user to administer Docker
            1. Getting ready
            2. How to do it…
            3. How it works…
          6. Setting up the Docker host with Docker Machine
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          7. Finding help with the Docker command line
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
        2. 2. Working with Docker Containers
          1. Introduction
          2. Listing/searching for an image
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          3. Pulling an image
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          4. Listing images
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          5. Starting a container
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          6. Listing containers
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          7. Looking at the logs of containers
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          8. Stopping a container
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          9. Deleting a container
            1. Getting ready
            2. How to do it…
            3. There's more…
            4. How it works…
            5. See also
          10. Setting the restart policy on a container
            1. Getting ready
            2. How to do it…
            3. There's more…
            4. See also
          11. Getting privileged access inside a container
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          12. Exposing a port while starting a container
            1. Getting ready
            2. How to do it…
            3. There's more…
            4. See also
          13. Accessing the host device inside the container
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          14. Injecting a new process to a running container
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          15. Returning low-level information about a container
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          16. Labeling and filtering containers
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
        3. 3. Working with Docker Images
          1. Introduction
          2. Creating an account with Docker Hub
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          3. Creating an image from the container
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          4. Publishing an image to the registry
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          5. Looking at the history of an image
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          6. Deleting an image
            1. Getting ready
            2. How to do it…
            3. There's more…
            4. See also
          7. Exporting an image
            1. Getting ready
            2. How to do it…
            3. There's more…
            4. See also
          8. Importing an image
            1. Getting ready
            2. How to do it…
            3. See also
          9. Building images using Dockerfiles
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          10. Building an Apache image – a Dockerfile example
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          11. Accessing Firefox from a container – a Dockerfile example
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more...
            5. See also
          12. Building a WordPress image – a Dockerfile example
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          13. Setting up a private index/registry
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          14. Automated builds – with GitHub and Bitbucket
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          15. Creating the base image – using supermin
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          16. Creating the base image – using Debootstrap
            1. Getting ready
            2. How to do it…
            3. See also
          17. Visualizing dependencies between layers
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
        4. 4. Network and Data Management for Containers
          1. Introduction
          2. Accessing containers from outside
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          3. Managing data in containers
            1. Getting ready
            2. How to do it...
            3. How it works…
            4. There's more…
            5. See also
          4. Linking two or more containers
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          5. Developing a LAMP application by linking containers
            1. Getting ready
            2. How to do it…
            3. How it works…
          6. Networking of multihost containers with Flannel
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          7. Assigning IPv6 addresses to containers
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
        5. 5. Docker Use Cases
          1. Introduction
          2. Testing with Docker
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
          3. Doing CI/CD with Shippable and Red Hat OpenShift
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          4. Doing CI/CD with Drone
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          5. Setting up PaaS with OpenShift Origin
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          6. Building and deploying an app on OpenShift v3 from the source code
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          7. Configuring Docker as a hypervisor driver for OpenStack
            1. Getting ready
            2. How to do it…
            3. How it works...
            4. There's more…
            5. See also
        6. 6. Docker APIs and Language Bindings
          1. Introduction
          2. Configuring the Docker daemon remote API
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          3. Performing image operations using remote APIs
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          4. Performing container operations using remote APIs
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          5. Exploring Docker remote API client libraries
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
          6. Securing the Docker daemon remote API
            1. Getting ready
            2. How to do it...
            3. How it works…
            4. There's more…
        7. 7. Docker Performance
          1. Introduction
          2. Benchmarking CPU performance
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          3. Benchmarking disk performance
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          4. Benchmarking network performance
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          5. Getting container resource usage using the stats feature
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          6. Setting up performance monitoring
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
        8. 8. Docker Orchestration and Hosting Platforms
          1. Introduction
          2. Running applications with Docker Compose
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          3. Setting up cluster with Docker Swarm
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          4. Setting up CoreOS for Docker orchestration
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          5. Setting up a Project Atomic host
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          6. Doing atomic update/rollback with Project Atomic
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          7. Adding more storage for Docker in Project Atomic
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          8. Setting up Cockpit for Project Atomic
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          9. Setting up a Kubernetes cluster
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          10. Scaling up and down in a Kubernetes cluster
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          11. Setting up WordPress with a Kubernetes cluster
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
        9. 9. Docker Security
          1. Introduction
          2. Setting Mandatory Access Control (MAC) with SELinux
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          3. Allowing writes to volume mounted from the host with SELinux ON
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          4. Removing capabilities to breakdown the power of a root user inside a container
            1. Getting ready
            2. How to do it...
            3. How it works…
            4. There's more...
            5. See also
          5. Sharing namespaces between the host and the container
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more...
            5. See also
        10. 10. Getting Help and Tips and Tricks
          1. Introduction
          2. Starting Docker in debug mode
            1. Getting ready
            2. How to do it...
            3. How it works…
          3. Building a Docker binary from the source
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          4. Building images without using cached layers
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
          5. Building your own bridge for container communication
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          6. Changing the default execution driver of Docker
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          7. Selecting the logging driver for containers
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          8. Getting real-time Docker events for containers
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
      7. 3. Module 3
        1. 1. Building Your Own Kubernetes
          1. Introduction
          2. Exploring architecture
            1. Getting ready
            2. How to do it…
              1. Kubernetes master
                1. API server (kube-apiserver)
                2. Scheduler (kube-scheduler)
                3. Controller manager (kube-controller-manager)
                4. Command Line Interface (kubectl)
              2. Kubernetes node
                1. kubelet
                2. Proxy (kube-proxy)
            3. How it works…
              1. etcd
              2. Overlay network
                1. Flannel
            4. See also
          3. Preparing your environment
            1. Getting ready
              1. Hardware resource
              2. Operating system
            2. How to do it…
              1. Kubernetes master
              2. Kubernetes nodes
              3. etcd
            3. See also
          4. Building datastore
            1. How to do it…
              1. Red Hat Enterprise Linux 7 or CentOS 7
              2. Ubuntu Linux 15.10 Wily Werewolf
              3. Other Linux
                1. Download a binary
                2. Creating a user
                3. Install etcd
            2. How it works…
              1. Auto startup script
                1. Startup script (systemd)
                2. Startup script (init)
              2. Configuration
            3. See also
          5. Creating an overlay network
            1. Getting ready
              1. Installation
                1. CentOS 7 or Red Hat Enterprise Linux 7
                2. Other Linux options
            2. How to do it…
              1. Flannel networking configuration
              2. Integrating with Docker
            3. How it works…
            4. See also
          6. Configuring master
            1. Getting ready
            2. How to do it…
              1. Installation
                1. CentOS 7 or Red Hat Enterprise Linux 7
                2. Adding daemon dependency
                3. Other Linux options
              2. Verification
            3. See also
          7. Configuring nodes
            1. Getting ready
            2. How to do it…
              1. Installation
                1. CentOS 7 or Red Hat Enterprise Linux 7
                2. Other Linux options
              2. Verification
            3. See also
          8. Run your first container in Kubernetes
            1. Getting ready
            2. How to do it…
              1. Running an HTTP server (nginx)
              2. Exposing the port for external access
              3. Stopping the application
            3. How it works…
            4. See also
        2. 2. Walking through Kubernetes Concepts
          1. Introduction
          2. An overview of Kubernetes control
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          3. Working with pods
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          4. Working with a replication controller
            1. Getting ready
            2. How to do it…
              1. Creating a replication controller
              2. Getting information of a replication controller
              3. Changing the configuration of a replication controller
              4. Removing a replication controller
            3. How it works…
            4. See also
          5. Working with services
            1. Getting ready
            2. How to do it…
              1. Creating services for different resources
                1. Creating a service for a pod
                2. Creating a service for the replication controller and adding an external IP
                3. Creating a no-selector service for an endpoint
                4. Creating a service with session affinity based on another service
              2. Creating a service in a different type
                1. Creating a service in NodePort type
              3. Deleting a service
            3. How it works…
            4. See also
          6. Working with volumes
            1. Getting ready
            2. How to do it…
              1. emptyDir
              2. hostPath
              3. nfs
              4. glusterfs
              5. iscsi
              6. flocker
              7. rbd
              8. gitRepo
              9. awsElasticBlockStore
              10. gcePersistentDisk
              11. downwardAPI
            3. There's more…
              1. PersistentVolume
            4. See also
          7. Working with secrets
            1. Getting ready
            2. How to do it…
              1. Creating a secret
              2. Picking up secret in the container
              3. Deleting a secret
            3. How it works…
            4. There's more…
            5. See also
          8. Working with names
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          9. Working with namespaces
            1. Getting ready
            2. How to do it…
              1. Changing the default namespace
              2. Deleting a namespace
            3. There's more…
              1. Deleting LimitRange
            4. See also
          10. Working with labels and selectors
            1. Getting ready
            2. How to do it…
              1. Linking service with a replication controller by using label selectors
            3. There's more…
            4. See also
        3. 3. Playing with Containers
          1. Introduction
          2. Scaling your containers
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          3. Updating live containers
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          4. Forwarding container ports
            1. Getting ready
            2. How to do it…
              1. Container-to-container communications
              2. Pod-to-pod communications
              3. Pod-to-service communications
              4. External-to-internal communications
            3. See also
          5. Ensuring flexible usage of your containers
            1. Getting ready
            2. How to do it…
              1. Pod as a job
                1. Creating a job with multiple pods running
              2. Pod as a daemon set
                1. Running the daemon set only on specific nodes
            3. How it works…
            4. See also
          6. Working with configuration files
            1. Getting ready
              1. YAML
              2. JSON
            2. How to do it…
            3. How it works…
              1. Pods
              2. Replication controllers
              3. Services
            4. See also
        4. 4. Building a High Availability Cluster
          1. Introduction
          2. Clustering etcd
            1. Getting ready
            2. How to do it…
              1. Static
              2. etcd discovery
            3. See also
          3. Building multiple masters
            1. Getting ready
            2. How to do it…
              1. Preparing multiple master nodes
              2. Setting up kubelet in master
              3. Getting the configuration files ready
              4. Starting the kubelet service and turning daemons on!
            3. How it works…
            4. See also
        5. 5. Building a Continuous Delivery Pipeline
          1. Introduction
          2. Moving monolithic to microservices
            1. Getting ready
            2. How to do it…
              1. Microservices
              2. Frontend WebUI
            3. How it works…
              1. Microservices
              2. Frontend WebUI
            4. See also
          3. Integrating with Jenkins
            1. Getting ready
              1. Install a Jenkins server which can build a Docker program
            2. How to do it…
              1. Create your Jenkins project
              2. Run a program testing
              3. Deploying a program
            3. How it works…
            4. There's more…
            5. See also
          4. Working with the private Docker registry
            1. Getting ready
            2. How to do it…
            3. How it works…
              1. Alternatives
                1. Docker Trusted Registry
                2. Nexus Repository Manager
                3. Amazon EC2 Container Registry
            4. See also
          5. Setting up the Continuous Delivery pipeline
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
        6. 6. Building Kubernetes on AWS
          1. Introduction
          2. Building the Kubernetes infrastructure in AWS
            1. Getting ready
            2. How to do it…
              1. VPC and subnets
              2. Internet Gateway and NAT
              3. Route Table
              4. Security group
            3. How it works…
            4. See also
          3. Managing applications using AWS OpsWorks
            1. Getting ready
            2. How to do it…
              1. The OpsWorks stack
              2. The OpsWorks layer
              3. Adjusting the IAM role
              4. The OpsWorks instance
            3. How it works…
            4. See also
          4. Auto-deploying Kubernetes through Chef recipes
            1. Getting ready
              1. Creating ELB and its security groups
              2. Creating an OpsWorks stack
              3. Creating application layers
            2. How to do it…
              1. Stack configuration for custom recipes
              2. Recipes for etcd
              3. Recipes for the Kubernetes master
              4. Recipes for the Kubernetes node
              5. Starting the instances
            3. See also
          5. Using AWS CloudFormation for fast provisioning
            1. Getting ready
            2. How to do it…
              1. Creating a network infrastructure
              2. Creating OpsWorks for application management
            3. See also
        7. 7. Advanced Cluster Administration
          1. Introduction
          2. Advanced settings in kubeconfig
            1. Getting ready
            2. How to do it…
              1. Setting a new credential
              2. Setting a new cluster
              3. Setting and changing the current context
              4. Cleaning up kubeconfig
            3. See also
          3. Setting resource in nodes
            1. Getting ready
            2. How to do it…
              1. Managing node capacity
              2. Managing computing resources in a pod
            3. See also
          4. Playing with WebUI
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          5. Working with a RESTful API
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          6. Authentication and authorization
            1. Getting ready
            2. How to do it…
              1. Enabling authentication for an API call
                1. Basic authentication of etcd
                2. Basic authentication of the Kubernetes master
              2. Making use of user authorization
            3. See also
        8. 8. Logging and Monitoring
          1. Introduction
          2. Collecting application logs
            1. Getting ready
              1. Elasticsearch
            2. How to do it…
              1. Logstash
              2. Startup script
              3. Dockerfile
              4. Docker build
              5. Kubernetes replication controller and service
              6. Kibana
            3. How it works…
            4. See also
          3. Working with Kubernetes logs
            1. Getting ready
            2. How to do it…
            3. See also
          4. Working with etcd log
            1. Getting ready
            2. How to do it…
            3. See also
          5. Monitoring master and node
            1. Getting ready
              1. Updating Kubernetes to the latest version: 1.2.1
              2. Setting up the DNS server
                1. Start the server using templates
                2. Enable Kubernetes DNS in kubelet
            2. How to do it…
              1. Installing a monitoring cluster
              2. Introducing the Grafana dashboard
                1. Creating a new metric to monitor pods
            3. See also
      8. B. Bibliography
      9. Index

    Product information

    • Title: DevOps: Puppet, Docker, and Kubernetes
    • Author(s): Thomas Uphill, John Arundel, Neependra Khare, Hideto Saito, Hui-Chuan Chloe Lee, Ke-Jou Carol Hsu
    • Release date: March 2017
    • Publisher(s): Packt Publishing
    • ISBN: 9781788297615