How do Kubernetes Deployments work?

This post is part 3 in a series on the Kubernetes API. Earlier,
Part 1
focused on the lifecycle of a Pod
and
Part 2
focused on the lifecycle of a Service
.
What is happening when a Deployment
rolls out a change to your app?
What does it actually do when a Pod
crashes or is killed? What happens
when a Pod
is re-labled so that it’s not targeted by the
Deployment
?
Deployment
is probably the most complex resource type in Kubernetes
core. Deployment
specifies how changes should be rolled out over
ReplicaSet
s, which themselves specify how Pod
s should be replicated
in a cluster.
In this post we continue our exploration of the Kubernetes API, cracking
Deployment
open using kubespy
, a small tool we developed to observe
Kubernetes resources in real-time.