Kubernetes Patterns: Reusable Elements for Designing Cloud-Native Applications

Kubernetes Patterns: Reusable Elements for Designing Cloud-Native Applications

by Bilgin Ibryam, Roland Huss

Paperback

$44.99 $49.99 Save 10% Current price is $44.99, Original price is $49.99. You Save 10%.
View All Available Formats & Editions
Choose Expedited Shipping at checkout for guaranteed delivery by Monday, September 23

Overview

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.

Product Details

ISBN-13: 9781492050285
Publisher: O'Reilly Media, Incorporated
Publication date: 04/26/2019
Pages: 266
Sales rank: 1,150,925
Product dimensions: 6.90(w) x 9.10(h) x 0.60(d)

About the Author

Bilgin Ibryam is a principal middleware architect at Red Hat, and a committer to multiple projects at the Apache Software Foundation. He is a regular blogger, open source evangelist, blockchain enthusiast, speaker, and the author of Camel Design Patterns book. He has over a decade of experience building and designing highly scalable, resilient, distributed systems.

In his day-to-day job, Bilgin enjoys mentoring, coding and leading enterprise companies to be successful with building open source solutions. His current work focuses on enterprise blockchain, distributed systems, microservices, and cloud-native applications in general.

Dr. Roland Huß is a software engineer at Red Hat who worked as tech lead on Fuse Online and landed recently in the OCF team for coding on Knative. He has been developing in Java for over twenty years now and found recently another love with Golang. However, he never forgot his roots as a system administrator. Roland is an active open source contributor, lead developer of the JMX-HTTP bridge Jolokia and some popular Java build tools for creating container images and deploying them on Kubernetes and OpenShift. Besides coding, he enjoys to spread the word on conferences and writing about his work.

Table of Contents

Foreword ix

Preface xi

1 Introduction 1

The Path to Cloud Native 1

Distributed Primitives 3

Containers 4

Pods 5

Services 7

Labels 7

Annotations 9

Namespaces 9

Discussion 11

More Information 12

Part I Foundational Patterns

2 Predictable Demands 15

Problem 15

Solution 16

Runtime Dependencies 16

Resource Profiles 18

Pod Priority 20

Project Resources 22

Capacity Planning 22

Discussion 23

More Information 24

3 Declarative Deployment 25

Problem 25

Solution 25

Rolling Deployment 27

Fixed Deployment 29

Blue-Green Release 30

Canary Release 30

Discussion 31

More Information 33

4 Health Probe 35

Problem 35

Solution 35

Process Health Checks 36

Liveness Probes 36

Readiness Probes 37

Discussion 38

More Information 40

5 Managed Lifecycle 41

Problem 41

Solution 41

SIGTERM Signal 42

SIGKILL Signal 42

Poststart Hook 43

Prestop Hook 44

Other Lifecycle Controls 45

Discussion 46

More Information 46

6 Automated Placement 47

Problem 47

Solution 47

Available Node Resources 48

Container Resource Demands 49

Placement Policies 49

Scheduling Process 50

Node Affinity 51

Pod Affinity and Antiaffinity 52

Taints and Tolerations 54

Discussion 57

More Information 59

Part II Behavioral Patterns

7 Batch Job 63

Problem 63

Solution 64

Discussion 67

More Information 68

8 Periodic Job 69

Problem 69

Solution 70

Discussion 71

More Information 72

9 Daemon Service 73

Problem 73

Solution 74

Discussion 76

More Information 77

10 Singleton Service 79

Problem 79

Solution 80

Out-of-Application Locking 80

In-Application Locking 82

Pod Disruption Budget 84

Discussion 85

More Information 86

11 Stateful Service 87

Problem 87

Storage 88

Networking 89

Identity 89

Ordinality 89

Other Requirements 89

Solution 90

Storage 91

Networking 92

Identity 94

Ordinality 94

Other Features 94

Discussion 96

More information 97

12 Service Discovery 99

Problem 99

Solution 100

Internal Service Discovery 101

Manual Service Discovery 104

Service Discovery from Outside the Cluster 107

Application Layer Service Discovery 111

Discussion 113

More Information 115

13 Self Awareness 117

Problem 117

Solution 117

Discussion 121

More Information 121

Part III Structural Patterns

14 Init Container 125

Problem 125

Solution 126

Discussion 130

More Information 130

15 Sidecar 131

Problem 131

Solution 132

Discussion 134

More Information 134

16 Adapter 135

Problem 135

Solution 135

Discussion 138

More Information 138

17 Ambassador 139

Problem 139

Solution 139

Discussion 141

More Information 142

Part IV Configuration Patterns

18 EnvVar Configuration 145

Problem 145

Solution 145

Discussion 148

More Information 149

19 Configuration Resource 151

Problem 151

Solution 151

Discussion 156

More Information 156

20 Immutable Configuration 157

Problem 157

Solution 157

Docker Volumes 158

Kubernetes Init Containers 159

OpenShift Templates 162

Discussion 163

More Information 164

21 Configuration Template 165

Problem 165

Solution 165

Discussion 170

More Information 171

Part V Advanced Patterns

22 Controller 175

Problem 175

Solution 176

Discussion 186

More Information 187

23 Operator 189

Problem 189

Solution 190

Custom Resource Definitions 190

Controller and Operator Classification 192

Operator Development and Deployment 195

Example 197

Discussion 201

More Information 202

24 Elastic Scale 203

Problem 203

Solution 204

Manual Horizontal Scaling 204

Horizontal Pod Autoscaling 205

Vertical Pod Autoscaling 210

Cluster Autoscaling 213

Scaling Levels 216

Discussion 219

More Information 219

25 Image Builder 221

Problem 221

Solution 222

OpenShift Build 223

Knative Build 230

Discussion 234

More Information 235

Afterword 237

Index 239

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews