Kubernetes in Action
Marko Lukša
  • MEAP began August 2016
  • Publication in Summer 2017 (estimated)
  • ISBN 9781617293726
  • 425 pages (estimated)
  • printed in black & white

Monolithic applications are becoming a thing of the past as we move towards smaller, independently running microservices that can be developed, deployed, updated and scaled individually. But it can be difficult to configure, manage, and keep the whole system running properly. This is where Kubernetes comes in. Think of Kubernetes as an operating system for your cluster, making it easier to organize and schedule your application's components across a fleet of machines. With Kubernetes, you don't have to worry about which specific machine in your data center your application is running on. And even better, it provides you with primitives for health checking and replicating your application across these machines. Each layer in your application is decoupled from other layers so you can scale, update, and maintain them independently. With more and more big companies accepting the Kubernetes model as the best way to run apps, it is set to become the standard way of running distributed apps both in the cloud and local on-premises infrastructure.

Kubernetes in Action teaches developers how to use Kubernetes to deploy self-healing scalable distributed applications. This clearly-written guide begins by looking at the problems system administrators and software developers face when running microservice-based applications and how deploying onto Kubernetes solves them. Next, you'll get your feet wet by running your first simple containerized web application on a Kubernetes cluster running in Google Container Engine. The second part of the book explains the main concepts developers need to understand in order to run multi-component applications in Kubernetes, while the last part will explain what goes on inside Kubernetes and teach you how to tie everything you've learned in the first two parts together. By the end, you'll be able to build and deploy applications in a proper way to take full advantage of the Kubernetes platform.

Table of Contents detailed table of contents

Part 1: The Overview

1. Introducing Kubernetes

1.1. How development and deployment of apps has changed

1.1.1. Moving from monolithic apps to microservices

1.1.2. Moving to continuous delivery and DevOps

1.2. Providing a consistent environment to applications

1.2.1. Ensuring the same environment everywhere with Linux containers

1.2.2. A quick overview of Docker

1.3. Using Kubernetes to manage containerized apps

1.3.1. The architecture of a Kubernetes cluster

1.3.2. Running an application on Kubernetes

1.3.3. The benefits of using Kubernetes

1.4. Summary

2. First steps with Docker and Kubernetes

2.1. Creating, running and sharing a Docker image

2.1.1. Creating a trivial Node.js app

2.1.2. Creating a Dockerfile for the Docker image

2.1.3. Building the Docker image

2.1.4. Running the Docker image

2.1.5. Exploring the inside of a running container

2.1.6. Stopping and removing a container

2.1.7. Pushing the image to a Docker registry

2.2. Setting up a Kubernetes cluster

2.2.1. Running a local single-node Kubernetes cluster with minikube

2.2.2. Using a hosted Google Container Engine Kubernetes cluster

2.3. Running our app on Kubernetes

2.3.1. Deploying our Node.js app

2.3.2. Accessing our web application

2.3.3. The logical parts of our system

2.3.4. Scaling the application

2.3.5. Examining what nodes our app is running on

2.4. Summary

Part 2: Core concepts

3. Deploying containers by creating Pods

3.1. Introducing pods

3.1.1. Running multiple containers as a unit

3.1.2. Organizing containers across pods properly

3.2. Creating pods from YAML or JSON descriptors

3.2.1. Examining a YAML descriptor of an existing pod

3.2.2. Preparing a simple YAML descriptor for a pod

3.2.3. Using kubectl create to create the pod

3.2.4. Connecting to the pod through port forwarding

3.3. Organizing large numbers of pods through labels

3.3.1. Introducing labels

3.3.2. Setting labels when creating a pod

3.3.3. Modifying labels of existing pods

3.4. Operating on subsets of pods through label selectors

3.5. Annotating pods

3.5.1. Looking up an object’s annotations

3.5.2. Adding and modifying annotations

3.6. Using namespaces to group resources

3.6.1. Discovering other namespaces and their pods

3.6.2. Creating a namespace

3.6.3. Creating objects in other namespaces

3.6.4. Understanding the isolation provided by namespaces

3.7. Assigning computational resources to each pod

3.7.1. Specifying a pod’s resource requests and limits

3.7.2. Inspecting resource consumption by individual pods on a given node

3.7.3. Scheduling a pod that doesn’t fit

3.8. Constraining the list of nodes a pod is allowed to be scheduled to

3.8.1. Categorizing worker nodes through labels

3.8.2. Scheduling pods to specific types of worker nodes

3.8.3. Preventing pods from being scheduled to a node

3.9. Keeping pods healthy

3.9.1. Introducing liveness probes

3.9.2. Creating an HTTP GET liveness probe

3.10. Stopping and removing pods

3.11. Summary

4. Managing pods with Replication Controllers

4.1. Introducing Replication Controllers

4.1.1. The operation of a replication controller

4.1.2. Parts of a replication controller

4.2. Creating, using and deleting a replication controller

4.2.1. Creating a replication controller

4.2.2. Seeing the replication controller in action

4.2.3. Moving pods in and out of the scope of a replication controller

4.2.4. Changing the pod template

4.2.5. Horizontally scaling pods

4.2.6. Deleting a replication controller

4.3. Using ReplicaSets instead of replication controllers

4.3.1. Comparing a ReplicaSet to a ReplicationController

4.3.2. Creating a ReplicaSet

4.4. Using a DaemonSet to run exactly one instance of a pod on each node

4.5. Running pods that perform a single completable task

4.6. Summary

5. Exposing pods as a service

5.1. Introducing services

5.1.1. Exposing multiple pods through a single address

5.1.2. Discovering services

5.2. Connecting to external services

5.2.1. Introducing service endpoints

5.2.2. Manually configuring service endpoints

5.2.3. Creating an alias for an external service

5.3. Exposing services to external clients

5.3.1. Exposing a service externally by setting an external IP address on it

5.3.2. Exposing a service through a fixed port on all the cluster nodes

5.3.3. Exposing a service externally through a cloud provider’s load balancer

5.4. Exposing services externally through an Ingress object

5.4.1. Creating an Ingress object

5.4.2. Configuring Ingress to handle TLS traffic

5.5. Controlling when a pod is ready to be a part of a service

5.5.1. Introducing readiness probes

5.5.2. Adding a readiness probe to a pod

5.6. Using a headless service to discover pods

5.6.1. Creating a headless service

5.6.2. Discovering pods through DNS

5.7. Summary

6. Sharing disk storage between containers in a Pod

6.1. Understanding Volumes

6.1.1. Using Volumes to enable communication between a pod’s containers

6.1.2. Types of volumes

6.2. Using Volumes to share data between containers

6.2.1. Using an emptyDir volume

6.2.2. Using a Git repository as the starting point for a volume

6.3. Accessing files from the worker node’s filesystem

6.4. Using persistent storage across pods on different nodes

6.4.1. Using a GCE Persistent Disk in a Volume

6.4.2. Using other types of persistent volumes

6.5. Decoupling actual storage with PersistentVolumes and PersistentVolumeClaims

6.6. Dynamic provisioning of persistent volumes

6.6.1. Defining the available storage types with StorageClass objects

6.6.2. Requesting the storage class in a PersistentVolumeClaim

6.7. Summary

7. Passing configuration and sensitive information to containers

7.1. Configuring apps in general

7.2. Passing command-line arguments to containers

7.3. Setting environment variables for a container

7.3.1. Specifying an environment variable in a container definition

7.4. Decoupling configuration with a ConfigMap

7.4.1. Creating a ConfigMap

7.4.2. Passing a ConfigMap entry to containers via an environment variable

7.4.3. Passing a ConfigMap entry as a command-line argument

7.4.4. Using a configMap volume to expose ConfigMap entries as files

7.4.5. Updating an app’s config without having to restart the app

7.5. Using Secrets to pass sensitive data to containers securely

7.5.1. Exposing a secret as a set files in a secret volume

7.5.2. Creating a Secret

7.5.3. Comparing ConfigMaps and Secrets

7.6. Summary

8. Deploying and updating apps

8.1. Replacing pods with a new version

8.1.1. Deleting old pods and replacing them with new ones afterwards

8.1.2. Spinning up new pods and then deleting the old ones

8.2. Performing an automatic rolling update with kubectl

8.3. Using Deployments for managing apps declaratively

8.3.1. Creating a Deployment

8.3.2. Updating a Deployment

8.3.3. Rolling back a deployment

8.3.4. Controlling the rate of the rollout

8.3.5. Blocking rollouts of bad versions

8.4. Summary

Part 3: Beyond the basics

9. Running clustered stateful apps with PetSets

10. Understanding Kubernetes internals

11. Monitoring distributed apps through centralized logging and monitoring

12. Using hardware resources efficiently

13. Letting Kubernetes scale your system automatically

14. Ensuring your system is highly available

15. Troubleshooting tips & tricks

What's inside

  • Using Docker and Kubernetes
  • Deploying containers by creating Pods
  • Securely delivering sensitive information to containers
  • Understanding Kubernetes internals
  • Monitoring distributed apps
  • Automatically scaling your system

About the reader

The book is for both application developers as well as system administrators who want to learn about Kubernetes from the developer?s perspective

About the author

Marko Lukša is a software engineer at Red Hat with the Cloud Enablement Team, whose responsibility is to make Red Hat's Enterprise Middleware products run on OpenShift, the PaaS platform built on top of Kubernetes. He also has 15 years of teaching others, helping him understand the learner's perspective and how to present difficult topics in a clear and understandable way.

Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
Buy
MEAP combo $49.99 pBook + eBook
MEAP eBook $39.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks