liveBook · Manning

Chapter 15: Automating application updates with Deployments

What you will learn in chapter 15 of Kubernetes in Action, Second Edition

Introduces Deployments as the Kubernetes object for updating stateless workloads more seamlessly than ReplicaSets.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces Deployments as the Kubernetes object for updating stateless workloads more seamlessly than ReplicaSets.

Key terms: ReplicaSet, Deployment object, seamless pod updates

15.1 Introducing Deployments

Introduces Deployments as a declarative way to manage application pods through ReplicaSets and explains when they suit stateless or stateful workloads.

Key terms: Deployment, ReplicaSet, Pod template, replicas, label selector, declaratively, Deployment object, update, stateless workloads, stateful workload

15.1.1 Creating a Deployment

This section creates and inspects a Deployment, explains why it creates new pods rather than adopting existing ones, and shows where to diagnose missing pods.

Key terms: Deployment, ReplicaSet, replicas, selector, template, strategy, manifest, kubectl create, --dry-run=client, -o yaml

15.1.2 Scaling a Deployment

This section explains how Deployments scale through ReplicaSets, why direct changes to an owned ReplicaSet are undone, and how reapplying a manifest can accidentally change a Deployment’s replica count.

Key terms: Deployment controller, ReplicaSet controller, replicas field, kubectl scale, owned ReplicaSet, desired number of replicas, kubectl apply, kubectl.kubernetes.io/last-applied-configuration annotation

15.1.3 Deleting a Deployment

Explains what happens to a Deployment’s ReplicaSet and pods when the Deployment is deleted, and when a recreated Deployment can adopt them.

Key terms: Deployment, ReplicaSet, pods, --cascade=orphan, Deployment controller, Pod template

15.2 Updating a Deployment

This section explains why updating a Deployment’s Pod template replaces existing pods and introduces the strategies that govern their replacement.

Key terms: Deployment, ReplicaSet, Pod template, update strategy, Recreate, RollingUpdate

15.2.1 The Recreate strategy

This section shows how to run a Deployment update with the Recreate strategy, observe the replacement of its ReplicaSet and pods, and recognize the resulting interruption in service.

Key terms: Recreate, RollingUpdate, Pod template, kubectl edit, kubectl apply, kubectl set image, kubectl patch, image, pod labels, Deployment controller

15.2.2 The RollingUpdate strategy

This section shows how a Deployment’s RollingUpdate strategy gradually replaces pods while keeping the Service available, and how to configure and observe that rollout.

Key terms: RollingUpdate, Recreate, Service, Deployment controller, ReplicaSet, ready, minReadySeconds, strategy, type, kubectl apply

15.2.3 Configuring how many pods are replaced at a time

This section explains how maxSurge and maxUnavailable control the pace and capacity limits of a Deployment rolling update.

Key terms: maxSurge, maxUnavailable, desired number of replicas, Deployment controller, old ReplicaSet, new ReplicaSet, available replicas, terminating pods, percentages, rounding up

15.2.4 Pausing the rollout process

Explains how pausing a Deployment controls a rolling update and reveals a risk when a web application serves mixed versions.

Key terms: Deployment, rolling update, paused field, Deployment controller, ReplicaSets, session affinity, backwards compatibility, Blue/Green deployment strategy

15.2.5 Updating to a faulty version

Explains how pod availability can hold back a faulty Deployment rollout and how Kubernetes reports a rollout that stops progressing.

Key terms: ready, available, minReadySeconds, readiness probe, FAIL_AFTER_SECONDS, Progressing condition, ProgressDeadlineExceeded, progressDeadlineSeconds, kubectl rollout status

15.2.6 Rolling back a Deployment

Explains how to undo Deployment updates, inspect and select past revisions, distinguish rollback from reapplying a manifest, and restart a Deployment’s pods.

Key terms: kubectl rollout undo, RollingUpdate, kubectl rollout resume, kubectl rollout history, --revision, ReplicaSet, revisionHistoryLimit, Pod template, kubectl apply, update strategy

15.3 Implementing other deployment strategies

This section distinguishes Kubernetes’ built-in Deployment strategies from other strategies that require additional effort to implement.

Key terms: Deployment controller, Recreate, RollingUpdate, higher-level controller

15.3.1 The Canary deployment strategy

Explains two ways to test a new application version with canary pods before updating the rest.

Key terms: minReadySeconds, kubectl rollout pause, kubectl rollout resume, canary pods, canary Deployment, stable version, replicas, Service, rolling update

15.3.2 The A/B strategy

Explains how to direct selected users to a new application version for an A/B rollout using Ingress, and notes that support depends on the Ingress implementation.

Key terms: A/B deployment strategy, Deployments, Services, Ingress object, Ingress implementations

15.3.3 The Blue/Green strategy

Explains how two Deployments and a Service label selector enable an all-at-once traffic switch from Blue to Green.

Key terms: Blue/Green strategy, Blue Deployment, Green Deployment, Service, labels, label selector

15.3.4 Traffic shadowing

Explains how traffic shadowing tests a new application version with mirrored production traffic without serving its responses to clients.

Key terms: traffic shadowing, Deployment, pod labels, label selector, Service, Ingress, Ingress implementations

15.4 Summary

Summarizes how Deployments extend ReplicaSets to update pods, how update strategies differ, and how ownership affects deletion.

Where this is used later

Concepts explained in this chapter

← Chapter 14: Scaling and maintaining pods with ReplicaSets Chapter 16: Handling stateful applications with StatefulSets →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.