Pro ยท Lesson 3 of 12
A Pod runs. A Deployment keeps the right number of Pods running and replaces them on purpose.
Sign in to save your place.
A Pod is one boat. A ReplicaSet is the rule "keep three boats". A Deployment is the harbour master who can swap the boats for a new design without sinking all three at once.
Containers in the same Pod share the Pod IP address and can reach each other on localhost. They do not share a filesystem unless you mount a volume into both. If the node dies, that Pod is gone. Kubernetes can start a new Pod elsewhere. It will not be the same Pod name.
A bare Pod has no one to recreate it. Use a bare Pod for a short debug, not for the app you expect to stay up.
A Deployment names a Pod template, a replica count, and a strategy. The Deployment controller creates a ReplicaSet. The ReplicaSet controller creates or deletes Pods until the count matches.
A rolling update starts Pods from a new template before it removes the old ones, as far as maxUnavailable and maxSurge allow. kubectl rollout status and kubectl rollout undo talk to that history. The old ReplicaSet is how undo works.
| Field | Meaning | If you ignore it |
|---|---|---|
| replicas | How many Pods you want | The default is one |
| selector | Which Pods this object owns | A mismatch is rejected or strands Pods |
| strategy | How a new template replaces the old | The default rolling update can still stall if the new Pods never become Ready |
A container can be process-alive and still refuse traffic. Readiness probes are how a Service learns to skip that Pod. Liveness probes are how Kubernetes decides to restart a stuck container. Startup probes cover slow starts so liveness does not kill the process during boot. The observability lesson uses them while you debug.
Step 1 of 3You edit the Deployment. You do not hand-edit the ReplicaSet it owns.
Step 2 of 3The current ReplicaSet is the count and the template. The previous one stays so you can undo.
Step 3 of 3Pods are replaceable. A new Pod gets a new name and a new IP.
Apply this on the local cluster from the previous lesson. Then change the image tag and watch the rollout. Delete one Pod and watch it come back with a new name.
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello
spec:
replicas: 3
selector:
matchLabels:
app: hello
template:
metadata:
labels:
app: hello
spec:
containers:
- name: web
image: nginx:1.27
ports:
- containerPort: 80
readinessProbe:
httpGet:
path: /
port: 80
Checked against the linked documentation in October 2026. A later release can move a flag, a price, or a supported pair. Use the page for the version you installed.