Kubernetes: Up and Running

Book description

Legend has it that Google deploys over two billion application containers a week. How’s that possible? Google revealed the secret through a project called Kubernetes, an open source cluster orchestrator (based on its internal Borg system) that radically simplifies the task of building, deploying, and maintaining scalable distributed systems in the cloud. This practical guide shows you how Kubernetes and container technology can help you achieve new levels of velocity, agility, reliability, and efficiency.

Authors Kelsey Hightower, Brendan Burns, and Joe Beda—who’ve worked on Kubernetes at Google and other organizatons—explain how this system fits into the lifecycle of a distributed application. You will learn how to use tools and APIs to automate scalable distributed systems, whether it is for online services, machine-learning applications, or a cluster of Raspberry Pi computers.

  • Explore the distributed system challenges that Kubernetes addresses
  • Dive into containerized application development, using containers such as Docker
  • Create and run containers on Kubernetes, using the docker image format and container runtime
  • Explore specialized objects essential for running applications in production
  • Reliably roll out new software versions without downtime or errors
  • Get examples of how to develop and deploy real-world applications in Kubernetes

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. Kubernetes: A Dedication
    2. Who Should Read This Book
    3. Why We Wrote This Book
    4. A Word on Cloud-Native Applications Today
    5. Navigating This Book
    6. Online Resources
    7. Conventions Used in This Book
    8. Using Code Examples
    9. O’Reilly Safari
    10. How to Contact Us
  2. 1. Introduction
    1. Velocity
      1. The Value of Immutability
      2. Declarative Configuration
      3. Self-Healing Systems
    2. Scaling Your Service and Your Teams
      1. Decoupling
      2. Easy Scaling for Applications and Clusters
      3. Scaling Development Teams with Microservices
      4. Separation of Concerns for Consistency and Scaling
    3. Abstracting Your Infrastructure
    4. Efficiency
    5. Summary
  3. 2. Creating and Running Containers
    1. Container Images
      1. The Docker Image Format
    2. Building Application Images with Docker
      1. Dockerfiles
      2. Image Security
      3. Optimizing Image Sizes
    3. Storing Images in a Remote Registry
    4. The Docker Container Runtime
      1. Running Containers with Docker
      2. Exploring the kuard Application
      3. Limiting Resource Usage
    5. Cleanup
    6. Summary
  4. 3. Deploying a Kubernetes Cluster
    1. Installing Kubernetes on a Public Cloud Provider
      1. Google Container Service
      2. Installing Kubernetes with Azure Container Service
      3. Installing Kubernetes on Amazon Web Services
    2. Installing Kubernetes Locally Using minikube
    3. Running Kubernetes on Raspberry Pi
    4. The Kubernetes Client
      1. Checking Cluster Status
      2. Listing Kubernetes Worker Nodes
    5. Cluster Components
      1. Kubernetes Proxy
      2. Kubernetes DNS
      3. Kubernetes UI
    6. Summary
  5. 4. Common kubectl Commands
    1. Namespaces
    2. Contexts
    3. Viewing Kubernetes API Objects
    4. Creating, Updating, and Destroying Kubernetes Objects
    5. Labeling and Annotating Objects
    6. Debugging Commands
    7. Summary
  6. 5. Pods
    1. Pods in Kubernetes
    2. Thinking with Pods
    3. The Pod Manifest
      1. Creating a Pod
      2. Creating a Pod Manifest
    4. Running Pods
      1. Listing Pods
      2. Pod Details
      3. Deleting a Pod
    5. Accessing Your Pod
      1. Using Port Forwarding
      2. Getting More Info with Logs
      3. Running Commands in Your Container with exec
      4. Copying Files to and from Containers
    6. Health Checks
      1. Liveness Probe
      2. Readiness Probe
      3. Types of Health Checks
    7. Resource Management
      1. Resource Requests: Minimum Required Resources
      2. Capping Resource Usage with Limits
    8. Persisting Data with Volumes
      1. Using Volumes with Pods
      2. Different Ways of Using Volumes with Pods
      3. Persisting Data Using Remote Disks
    9. Putting It All Together
    10. Summary
  7. 6. Labels and Annotations
    1. Labels
      1. Applying Labels
      2. Modifying Labels
      3. Label Selectors
      4. Label Selectors in API Objects
    2. Annotations
      1. Defining Annotations
    3. Cleanup
    4. Summary
  8. 7. Service Discovery
    1. What Is Service Discovery?
    2. The Service Object
      1. Service DNS
      2. Readiness Checks
    3. Looking Beyond the Cluster
    4. Cloud Integration
    5. Advanced Details
      1. Endpoints
      2. Manual Service Discovery
      3. kube-proxy and Cluster IPs
      4. Cluster IP Environment Variables
    6. Cleanup
    7. Summary
  9. 8. ReplicaSets
    1. Reconciliation Loops
    2. Relating Pods and ReplicaSets
      1. Adopting Existing Containers
      2. Quarantining Containers
    3. Designing with ReplicaSets
    4. ReplicaSet Spec
      1. Pod Templates
      2. Labels
    5. Creating a ReplicaSet
    6. Inspecting a ReplicaSet
      1. Finding a ReplicaSet from a Pod
      2. Finding a Set of Pods for a ReplicaSet
    7. Scaling ReplicaSets
      1. Imperative Scaling with kubectl Scale
      2. Declaratively Scaling with kubectl apply
      3. Autoscaling a ReplicaSet
    8. Deleting ReplicaSets
    9. Summary
  10. 9. DaemonSets
    1. DaemonSet Scheduler
    2. Creating DaemonSets
    3. Limiting DaemonSets to Specific Nodes
      1. Adding Labels to Nodes
      2. Node Selectors
    4. Updating a DaemonSet
      1. Updating a DaemonSet by Deleting Individual Pods
      2. Rolling Update of a DaemonSet
    5. Deleting a DaemonSet
    6. Summary
  11. 10. Jobs
    1. The Job Object
    2. Job Patterns
      1. One Shot
      2. Parallelism
      3. Work Queues
    3. Summary
  12. 11. ConfigMaps and Secrets
    1. ConfigMaps
      1. Creating ConfigMaps
      2. Using a ConfigMap
    2. Secrets
      1. Creating Secrets
      2. Consuming Secrets
      3. Private Docker Registries
    3. Naming Constraints
    4. Managing ConfigMaps and Secrets
      1. Listing
      2. Creating
      3. Updating
    5. Summary
  13. 12. Deployments
    1. Your First Deployment
      1. Deployment Internals
    2. Creating Deployments
    3. Managing Deployments
    4. Updating Deployments
      1. Scaling a Deployment
      2. Updating a Container Image
      3. Rollout History
    5. Deployment Strategies
      1. Recreate Strategy
      2. RollingUpdate Strategy
      3. Slowing Rollouts to Ensure Service Health
    6. Deleting a Deployment
    7. Summary
  14. 13. Integrating Storage Solutions and Kubernetes
    1. Importing External Services
      1. Services Without Selectors
      2. Limitations of External Services: Health Checking
    2. Running Reliable Singletons
      1. Running a MySQL Singleton
      2. Dynamic Volume Provisioning
    3. Kubernetes-Native Storage with StatefulSets
      1. Properties of StatefulSets
      2. Manually Replicated MongoDB with StatefulSets
      3. Automating MongoDB Cluster Creation
      4. Persistent Volumes and StatefulSets
      5. One Final Thing: Readiness Probes
    4. Summary
  15. 14. Deploying Real-World Applications
    1. Parse
      1. Prerequisites
      2. Building the parse-server
      3. Deploying the parse-server
      4. Testing Parse
    2. Ghost
      1. Configuring Ghost
    3. Redis
      1. Configuring Redis
      2. Creating a Redis Service
      3. Deploying Redis
      4. Playing with Our Redis Cluster
    4. Summary
  16. A. Building a Raspberry Pi Kubernetes Cluster
    1. Parts List
    2. Flashing Images
    3. First Boot: Master
      1. Setting Up Networking
      2. Installing Kubernetes
      3. Setting Up the Cluster
    4. Summary
  17. Index

Product information

  • Title: Kubernetes: Up and Running
  • Author(s): Joe Beda, Kelsey Hightower, Brendan Burns
  • Release date: September 2017
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781491935675