Pro ยท Lesson 3 of 12

Pods and Deployments

A Pod runs. A Deployment keeps the right number of Pods running and replaces them on purpose.

Sign in to save your place.

Picture it this way

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.

What a Pod actually shares

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.

Deployments and ReplicaSets

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 Pod that is running can still be useless

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.

Who owns the Pods

  1. Deployment
  2. ReplicaSet
  3. Pods

Step 1 of 3You edit the Deployment. You do not hand-edit the ReplicaSet it owns.

Lab: three replicas of a tiny web server

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

Concept summary

Knowledge check

You delete a Pod that belongs to a Deployment. What happens?

Why add a readiness probe?

What should you edit to change the container image of an app?

Official sources

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.