Kubernetes Patterns

Book description

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

Each pattern includes a description of the problem and a proposed solution with Kubernetes specifics. Many patterns are also backed by concrete code examples. This book is ideal for developers already familiar with basic Kubernetes concepts who want to learn common cloud-native patterns.

You’ll learn about the following pattern categories:

  • Foundational patterns cover the core principles and practices for building container-based cloud-native applications.
  • Behavioral patterns explore finer-grained concepts for managing various types of container and platform interactions.
  • Structural patterns help you organize containers within a pod, the atom of the Kubernetes platform.
  • Configuration patterns provide insight into how application configurations can be handled in Kubernetes.
  • Advanced patterns cover more advanced topics such as extending the platform with operators.

Publisher resources

View/Submit Errata

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. Conventions
    7. Using Code Examples
    8. O’Reilly Online Learning
    9. How to Contact Us
    10. Acknowledgments
  3. 1. Introduction
    1. The Path to Cloud Native
    2. Distributed Primitives
      1. Containers
      2. Pods
      3. Services
      4. Labels
      5. Annotations
      6. 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
    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. Placement Policies
      4. Scheduling Process
      5. Node Affinity
      6. Pod Affinity and Antiaffinity
      7. 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. 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
  16. 12. 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
  17. 13. Self Awareness
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  18. III. Structural Patterns
  19. 14. Init Container
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  20. 15. Sidecar
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  21. 16. Adapter
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  22. 17. Ambassador
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  23. IV. Configuration Patterns
  24. 18. EnvVar Configuration
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  25. 19. Configuration Resource
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  26. 20. Immutable Configuration
    1. Problem
    2. Solution
      1. Docker Volumes
      2. Kubernetes Init Containers
      3. OpenShift Templates
    3. Discussion
    4. More Information
  27. 21. Configuration Template
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  28. V. Advanced Patterns
  29. 22. Controller
    1. Problem
    2. Solution
    3. Discussion
    4. More Information
  30. 23. 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
  31. 24. 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
  32. 25. Image Builder
    1. Problem
    2. Solution
      1. OpenShift Build
      2. Knative Build
    3. Discussion
    4. More Information
  33. Afterword
    1. Ubiquitous Platform
    2. Hybrid Responsibilities
    3. What We Covered
    4. Final Words
  34. Index

Product information

  • Title: Kubernetes Patterns
  • Author(s): Bilgin Ibryam, Roland Huß
  • Release date: April 2019
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781492050230