Kubernetes Patterns, 2nd Edition

Book description

This second edition comes with a dedicated playlist of interactive Katacoda labs mapped to sections of the book. As you read through each chapter, you can practice the concepts covered by referring to the labs playlist or to the links provided at the end of applicable chapters.

The way developers design, build, and run software has changed significantly with the evolution of microservices and containers. These modern architectures offer new distributed primitives that require a different set of practices than many developers, tech leads, and architects are accustomed to. With this focused guide, Bilgin Ibryam and Roland Huss provide common reusable patterns and principles for designing and implementing cloud native applications on Kubernetes.

Each pattern includes a description of the problem and a Kubernetes-specific solution. All patterns are backed by and demonstrated with concrete code examples. This updated edition is ideal for developers and architects familiar with basic Kubernetes concepts who want to learn how to solve common cloud native challenges with proven design patterns.

You'll explore:

  • Foundational patterns covering core principles and practices for building and running container-based cloud native applications
  • Behavioral patterns that delve into finer-grained concepts for managing various types of container and platform interactions
  • Structural patterns for organizing containers within a Pod for addressing specific use cases
  • Configuration patterns that provide insight into how application configurations can be handled in Kubernetes
  • Security patterns for hardening the access to cloud native applications running on KubernetesAdvanced patterns covering more complex topics such as operators and autoscaling

Table of contents

  1. Foreword
  2. Preface
    1. Kubernetes
    2. Design Patterns
    3. How This Book Is Structured
    4. Who This Book Is For
    5. What You Will Learn
    6. What’s New in the Second Edition
    7. Conventions Used in This Book
    8. Using Code Examples
    9. O’Reilly Online Learning
    10. How to Contact Us
    11. Acknowledgments
  3. 1. Introduction
    1. The Path to Cloud Native
    2. Distributed Primitives
      1. Containers
      2. Pods
      3. Services
      4. Labels
      5. Namespaces
    3. Discussion
    4. More Information
  4. I. Foundational Patterns
  5. 2. Predictable Demands
    1. Problem
    2. Solution
      1. Runtime Dependencies
      2. Resource Profiles
      3. Pod Priority
      4. Project Resources
      5. Capacity Planning
    3. Discussion
    4. More Information
  6. 3. Declarative Deployment
    1. Problem
    2. Solution
      1. Rolling Deployment
      2. Fixed Deployment
      3. Blue-Green Release
      4. Canary Release
    3. Discussion
    4. More Information
  7. 4. Health Probe
    1. Problem
    2. Solution
      1. Process Health Checks
      2. Liveness Probes
      3. Readiness Probes
      4. Startup Probes
    3. Discussion
    4. More Information
  8. 5. Managed Lifecycle
    1. Problem
    2. Solution
      1. SIGTERM Signal
      2. SIGKILL Signal
      3. PostStart Hook
      4. PreStop Hook
      5. Other Lifecycle Controls
    3. Discussion
    4. More Information
  9. 6. Automated Placement
    1. Problem
    2. Solution
      1. Available Node Resources
      2. Container Resource Demands
      3. Scheduler Configurations
      4. Scheduling Process
      5. Node Affinity
      6. Pod Affinity and Anti-Affinity
      7. Topology Spread Constraints
      8. Taints and Tolerations
    3. Discussion
    4. More Information
  10. II. Behavioral Patterns
  11. 7. Batch Job
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  12. 8. Periodic Job
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  13. 9. Daemon Service
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  14. 10. Singleton Service
    1. Problem
    2. Solution
      1. Out-of-Application Locking
      2. In-Application Locking
      3. Pod Disruption Budget
    3. Discussion
    4. More Information
  15. 11. Stateless Service
    1. Problem
    2. Solution
      1. Instances
      2. Networking
      3. Storage
    3. Discussion
    4. More Information
  16. 12. Stateful Service
    1. Problem
      1. Storage
      2. Networking
      3. Identity
      4. Ordinality
      5. Other Requirements
    2. Solution
      1. Storage
      2. Networking
      3. Identity
      4. Ordinality
      5. Other Features
    3. Discussion
    4. More Information
  17. 13. Service Discovery
    1. Problem
    2. Solution
      1. Internal Service Discovery
      2. Manual Service Discovery
      3. Service Discovery from Outside the Cluster
      4. Application Layer Service Discovery
    3. Discussion
    4. More Information
  18. 14. Self Awareness
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  19. III. Structural Patterns
  20. 15. Init Container
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  21. 16. Sidecar
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  22. 17. Adapter
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  23. 18. Ambassador
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  24. IV. Configuration Patterns
  25. 19. EnvVar Configuration
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  26. 20. Configuration Resource
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  27. 21. Immutable Configuration
    1. Problem
    2. Solution
      1. Docker Volumes
      2. Kubernetes Init Containers
      3. OpenShift Templates
    3. Discussion
    4. More Information
  28. 22. Configuration Template
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  29. V. Security Patterns
  30. 23. Process Containment
    1. Problem
    2. Solution
      1. Running Containers with a Non-Root User
      2. Restricting Container Capabilities
      3. Avoiding a Mutable Container Filesystem
      4. Enforcing Security Policies
    3. Discussion
    4. More Information
  31. 24. Network Segmentation
    1. Problem
    2. Solution
      1. Network Policies
      2. Authorization Policies
    3. Discussion
    4. More Information
  32. 25. Secure Configuration
    1. Problem
    2. Solution
      1. Out-of-Cluster Encryption
      2. Centralized Secret Management
    3. Discussion
    4. More Information
  33. 26. Access Control
    1. Problem
    2. Solution
      1. Authentication
      2. Authorization
      3. Admission Controllers
      4. Subject
      5. Role-Based Access Control
    3. Discussion
    4. More Information
  34. VI. Advanced Patterns
  35. 27. Controller
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  36. 28. Operator
    1. Problem
    2. Solution
      1. Custom Resource Definitions
      2. Controller and Operator Classification
      3. Operator Development and Deployment
      4. Example
    3. Discussion
    4. More Information
  37. 29. Elastic Scale
    1. Problem
    2. Solution
      1. Manual Horizontal Scaling
      2. Horizontal Pod Autoscaling
      3. Vertical Pod Autoscaling
      4. Cluster Autoscaling
      5. Scaling Levels
    3. Discussion
    4. More Information
  38. 30. Image Builder
    1. Problem
    2. Solution
      1. Container Image Builder
      2. Build Orchestrators
      3. Build Pod
      4. OpenShift Build
    3. Discussion
    4. More Information
  39. Afterword
    1. What We Covered
    2. Final Words
  40. Index
  41. About the Authors

Product information

  • Title: Kubernetes Patterns, 2nd Edition
  • Author(s): Bilgin Ibryam, Roland Huss
  • Release date: March 2023
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781098131685