Verifying Pods, ReplicaSets, and Deployments on a kind cluster
Run a three-node kind cluster to verify Kubernetes ownership layers, Pod self-healing, rolling updates, rollbacks, and how they differ from Docker and Swarm.
Unlike running a single container with Docker, Kubernetes splits workload scheduling, replica maintenance, and release history across Pods, ReplicaSets, and Deployments. On a three-node
kindcluster, I verified this ownership chain, 1-second Pod self-healing, rolling updates, and rollbacks.
All command outputs below were observed on a three-node
kind v0.33.0cluster running Kubernetesv1.37.0(containerd://2.3.4) withkubectl v1.36.1on macOS (arm64). The core workload APIs (apps/v1,v1) behave identically across Kubernetes 1.35–1.37.
Comparing Docker containers with Kubernetes workload layers
In my earlier post on Docker container lifecycle, volumes, and bridge networking, docker run created and managed containers directly on a single host. There, the container itself is the unit of execution and management. Kubernetes doesn’t schedule raw containers directly. Instead, it separates concerns into three layers: Pod, ReplicaSet, and Deployment.
| Dimension | Single Docker (docker run) | Docker Swarm | Kubernetes |
|---|---|---|---|
| Smallest deployable unit | Container | Task (single container) | Pod (one or more containers) |
| Replication & recovery | --restart (local restart) | Manager reschedules tasks | ReplicaSet control loop |
| Rolling updates & history | Manual stop and recreate | Service update_config | Deployment revisions |
| Network identity | Per-container bridge IP | Overlay VIP / Task IP | Unique Pod IP (changes on replace) |
Each layer handles a different lifecycle concern:
- Pod: The smallest scheduling unit in Kubernetes. Containers inside a Pod share one network namespace (same IP and
localhost) and shared volumes. Most Pods run a single application container, though you can pair tightly coupled helpers such as log shippers or proxies when they must share a lifecycle. - ReplicaSet: A controller that continuously compares the number of Pods matching its
selectoragainstreplicas. If a Pod disappears or a node fails, the ReplicaSet creates a replacement to close the gap. - Deployment: A declarative manager sitting above ReplicaSets. When you update a container image, the Deployment doesn’t mutate running Pods in place. It creates a new ReplicaSet, shifts traffic gradually via a RollingUpdate, and keeps old ReplicaSets scaled to zero for fast rollbacks.
Compared to the two-layer Service → Task model I covered in replicating services and moving tasks with Docker Swarm, Kubernetes separates replica enforcement from release history so each controller stays focused and extensible.
flowchart TD
D["Deployment<br/>(web-app)"] -->|"Tracks revisions"| RS["ReplicaSet<br/>(web-app-df4446b8f)"]
RS -->|"Maintains count"| P1["Pod 1<br/>(worker2)"]
RS -->|"Maintains count"| P2["Pod 2<br/>(worker)"]
P1 --> C1["nginx container"]
P2 --> C2["nginx container"]
Verifying the ownership hierarchy on a three-node kind cluster
You don’t need a managed cloud cluster to inspect multi-node scheduling. kind (Kubernetes IN Docker) runs Kubernetes nodes as Docker containers. For this run, I used a three-node cluster (kind-k8s-lab) with one control-plane node and two workers.
1
2
kubectl --context kind-k8s-lab wait --for=condition=Ready nodes --all --timeout=60s
kubectl --context kind-k8s-lab get nodes -o wide
1
2
3
4
5
6
7
node/k8s-lab-control-plane condition met
node/k8s-lab-worker condition met
node/k8s-lab-worker2 condition met
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
k8s-lab-control-plane Ready control-plane 79s v1.37.0 172.22.0.4 <none> Debian GNU/Linux 13 (trixie) 7.0.14-linuxkit (arm64) containerd://2.3.4
k8s-lab-worker Ready <none> 65s v1.37.0 172.22.0.2 <none> Debian GNU/Linux 13 (trixie) 7.0.14-linuxkit (arm64) containerd://2.3.4
k8s-lab-worker2 Ready <none> 65s v1.37.0 172.22.0.3 <none> Debian GNU/Linux 13 (trixie) 7.0.14-linuxkit (arm64) containerd://2.3.4
Next, create an isolated namespace (lab-d4-workloads) and a minimal Deployment running two nginx:1.27-alpine replicas. The spec.selector.matchLabels block must match spec.template.metadata.labels so the ReplicaSet knows which Pods belong to it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# web-app-deployment.yaml
apiVersion: v1
kind: Namespace
metadata:
name: lab-d4-workloads
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-app
namespace: lab-d4-workloads
spec:
replicas: 2
selector:
matchLabels:
app: web-app
template:
metadata:
labels:
app: web-app
spec:
containers:
- name: nginx
image: nginx:1.27-alpine
ports:
- containerPort: 80
After applying the manifest, inspect the Deployment, ReplicaSet, Pods, and their metadata.ownerReferences links.
1
2
3
4
5
kubectl --context kind-k8s-lab apply -f web-app-deployment.yaml
kubectl --context kind-k8s-lab -n lab-d4-workloads rollout status deployment/web-app --timeout=90s
kubectl --context kind-k8s-lab -n lab-d4-workloads get deploy,rs,pod -o wide
kubectl --context kind-k8s-lab -n lab-d4-workloads get rs -o 'custom-columns=NAME:.metadata.name,OWNER_KIND:.metadata.ownerReferences[0].kind,OWNER_NAME:.metadata.ownerReferences[0].name'
kubectl --context kind-k8s-lab -n lab-d4-workloads get pod -o 'custom-columns=NAME:.metadata.name,OWNER_KIND:.metadata.ownerReferences[0].kind,OWNER_NAME:.metadata.ownerReferences[0].name,IP:.status.podIP,NODE:.spec.nodeName'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
deployment.apps/web-app 2/2 2 2 5s nginx nginx:1.27-alpine app=web-app
NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR
replicaset.apps/web-app-df4446b8f 2 2 2 5s nginx nginx:1.27-alpine app=web-app,pod-template-hash=df4446b8f
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
pod/web-app-df4446b8f-4dp46 1/1 Running 0 5s 10.244.1.2 k8s-lab-worker2 <none> <none>
pod/web-app-df4446b8f-s9mdz 1/1 Running 0 5s 10.244.2.3 k8s-lab-worker <none> <none>
NAME OWNER_KIND OWNER_NAME
web-app-df4446b8f Deployment web-app
NAME OWNER_KIND OWNER_NAME IP NODE
web-app-df4446b8f-4dp46 ReplicaSet web-app-df4446b8f 10.244.1.2 k8s-lab-worker2
web-app-df4446b8f-s9mdz ReplicaSet web-app-df4446b8f 10.244.2.3 k8s-lab-worker
Two details stand out here. First, ownerReferences makes the hierarchy explicit: Deployment/web-app owns ReplicaSet/web-app-df4446b8f, which owns both Pods. The df4446b8f suffix is a pod-template-hash automatically added to the ReplicaSet selector. Second, the scheduler spread the two Pods across k8s-lab-worker2 and k8s-lab-worker so a single worker failure won’t take down both replicas.
Testing ReplicaSet self-healing by deleting a Pod
Next, delete one running Pod (web-app-df4446b8f-4dp46, IP 10.244.1.2) and watch how the ReplicaSet controller responds.
1
2
3
4
kubectl --context kind-k8s-lab -n lab-d4-workloads delete pod web-app-df4446b8f-4dp46
kubectl --context kind-k8s-lab -n lab-d4-workloads wait --for=condition=Ready pod -l app=web-app --timeout=90s
kubectl --context kind-k8s-lab -n lab-d4-workloads get pod -o wide
kubectl --context kind-k8s-lab -n lab-d4-workloads get events --sort-by='.lastTimestamp' --field-selector involvedObject.kind=ReplicaSet
1
2
3
4
5
6
7
8
9
10
11
12
pod "web-app-df4446b8f-4dp46" deleted from lab-d4-workloads namespace
pod/web-app-df4446b8f-s4d9c condition met
pod/web-app-df4446b8f-s9mdz condition met
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
pod/web-app-df4446b8f-s4d9c 1/1 Running 0 1s 10.244.1.3 k8s-lab-worker2 <none> <none>
pod/web-app-df4446b8f-s9mdz 1/1 Running 0 13s 10.244.2.3 k8s-lab-worker <none> <none>
LAST SEEN TYPE REASON OBJECT MESSAGE
13s Normal SuccessfulCreate replicaset/web-app-df4446b8f Created pod: web-app-df4446b8f-4dp46
13s Normal SuccessfulCreate replicaset/web-app-df4446b8f Created pod: web-app-df4446b8f-s9mdz
1s Normal SuccessfulCreate replicaset/web-app-df4446b8f Created pod: web-app-df4446b8f-s4d9c
The ReplicaSet controller detected that only one Pod remained, created a replacement (web-app-df4446b8f-s4d9c), and reached Ready in about 1 second. Meanwhile, the surviving Pod (web-app-df4446b8f-s9mdz) kept running without interruption.
Notice the key difference from a single Docker container: Kubernetes did not restart the old Pod in place. It created a brand-new Pod with a new name and a new IP (10.244.1.2 → 10.244.1.3). While docker run --name web --restart always keeps the same container identity on one host, Kubernetes treats Pods as ephemeral. Hardcoding Pod IPs breaks right after self-healing, which is why Services and CoreDNS are mandatory for stable service discovery.
Rolling updates, rollbacks, and the last-applied-configuration drift
Now update the image from nginx:1.27-alpine to nginx:1.28-alpine to observe a RollingUpdate, then roll it back with kubectl rollout undo.
1
2
3
4
5
6
7
8
9
10
11
12
# 1. Trigger a RollingUpdate
kubectl --context kind-k8s-lab -n lab-d4-workloads set image deployment/web-app nginx=nginx:1.28-alpine
kubectl --context kind-k8s-lab -n lab-d4-workloads rollout status deployment/web-app --timeout=90s
kubectl --context kind-k8s-lab -n lab-d4-workloads rollout history deployment/web-app
kubectl --context kind-k8s-lab -n lab-d4-workloads get rs -o wide
# 2. Roll back to the previous revision
kubectl --context kind-k8s-lab -n lab-d4-workloads rollout undo deployment/web-app
kubectl --context kind-k8s-lab -n lab-d4-workloads rollout status deployment/web-app --timeout=90s
kubectl --context kind-k8s-lab -n lab-d4-workloads rollout history deployment/web-app
kubectl --context kind-k8s-lab -n lab-d4-workloads get rs -o wide
kubectl --context kind-k8s-lab -n lab-d4-workloads get events --sort-by='.lastTimestamp' --field-selector involvedObject.kind=Deployment
After the RollingUpdate completes, rollout history and get rs show two ReplicaSets:
1
2
3
4
5
6
7
8
deployment "web-app" successfully rolled out
REVISION CHANGE-CAUSE
1 <none>
2 <none>
NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR
replicaset.apps/web-app-5d986f8566 2 2 2 10s nginx nginx:1.28-alpine app=web-app,pod-template-hash=5d986f8566
replicaset.apps/web-app-df4446b8f 0 0 0 32s nginx nginx:1.27-alpine app=web-app,pod-template-hash=df4446b8f
The Deployment created a new ReplicaSet (web-app-5d986f8566, Revision 2) for nginx:1.28-alpine and scaled the old ReplicaSet (web-app-df4446b8f) down to zero without deleting it. Running rollout undo then reactivates the old ReplicaSet as Revision 3:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Warning: resource deployments/web-app was previously managed with 'kubectl apply'. Rolling back will not update the kubectl.kubernetes.io/last-applied-configuration annotation, which may cause unexpected behavior on future 'kubectl apply' operations. Consider using 'kubectl apply' with your previous configuration file instead.
deployment.apps/web-app rolled back
deployment "web-app" successfully rolled out
REVISION CHANGE-CAUSE
2 <none>
3 <none>
NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR
replicaset.apps/web-app-5d986f8566 0 0 0 11s nginx nginx:1.28-alpine app=web-app,pod-template-hash=5d986f8566
replicaset.apps/web-app-df4446b8f 2 2 2 33s nginx nginx:1.27-alpine app=web-app,pod-template-hash=df4446b8f
LAST SEEN TYPE REASON OBJECT MESSAGE
33s Normal ScalingReplicaSet deployment/web-app Scaled up replica set web-app-df4446b8f from 0 to 2
11s Normal ScalingReplicaSet deployment/web-app Scaled up replica set web-app-5d986f8566 from 0 to 1
7s Normal ScalingReplicaSet deployment/web-app Scaled down replica set web-app-df4446b8f from 2 to 1
7s Normal ScalingReplicaSet deployment/web-app Scaled up replica set web-app-5d986f8566 from 1 to 2
1s Normal ScalingReplicaSet deployment/web-app Scaled down replica set web-app-df4446b8f from 1 to 0
1s Normal ScalingReplicaSet deployment/web-app Scaled up replica set web-app-df4446b8f from 0 to 1
0s Normal ScalingReplicaSet deployment/web-app Scaled down replica set web-app-5d986f8566 from 2 to 1
0s Normal ScalingReplicaSet deployment/web-app Scaled up replica set web-app-df4446b8f from 1 to 2
0s Normal ScalingReplicaSet deployment/web-app Scaled down replica set web-app-5d986f8566 from 1 to 0
The ScalingReplicaSet events trace the default RollingUpdate strategy: for 2 replicas, maxSurge: 25% rounds up to 1 extra Pod (up to 3 total), while maxUnavailable: 25% rounds down to 0 Pods (keeping 2 available at all times). That is why the new ReplicaSet scaled 0 → 1 first before the old one scaled 2 → 1, then the new one reached 2 before the old one dropped to 0. The rollback mirrored that exact sequence in reverse.
Mixing imperative commands (
kubectl set image,kubectl rollout undo) with a Deployment managed bykubectl applyleaves thekubectl.kubernetes.io/last-applied-configurationannotation out of sync, as shown in the warning above. Futurekubectl applythree-way merges can behave unexpectedly. In declarative or GitOps workflows, revert the manifest in Git and re-apply it rather than relying onrollout undo.
Keep one limitation of this minimal manifest in mind: it omits readinessProbe, so Kubernetes marks each Pod Ready as soon as nginx starts. Real applications with slow startup times (such as Spring Boot services) need explicit readinessProbe checks and preStop hooks to avoid dropping traffic during rollouts.
Choosing between Compose, Swarm, and Kubernetes
Self-healing and declarative rollouts make Kubernetes appealing, but it isn’t the right default for every workload. Operational overhead scales very differently across these three options.
| Decision factor | Docker / Compose | Docker Swarm | Kubernetes |
|---|---|---|---|
| Target host count | Single host | Small multi-node (2–10) | Multi-node & elastic scale |
| Primary strength | Minimal config, fast iteration | Built into Docker Engine | Standard APIs, rich ecosystem |
| Recovery & rollouts | Local restart only | Node failover & rolling updates | Fine-grained loops & probes |
| Operational overhead | Low | Moderate | High (control plane, CNI, storage) |
You should skip Kubernetes when any of these conditions apply:
- One server comfortably handles your traffic and uptime requirements; Docker Compose gets you running with a fraction of the configuration.
- Your team lacks bandwidth to maintain cluster upgrades, CNI networking, storage classes, and RBAC policies. Spending more time operating the cluster than shipping features is a common early-stage trap.
- You only need simple multi-node failover across a few hosts. Docker Swarm or a managed container service (such as AWS ECS or Cloud Run) often solves that problem with much lower operational friction.
Kubernetes pays off once multiple teams deploy many services on shared infrastructure, or when you genuinely need autoscaling (HPA), standardized traffic routing (Gateway API), and GitOps-driven declarative deployments.
Practical takeaways and checklist
Before moving from local kind experiments to production Deployments, check these four items:
- Treat Pods as ephemeral: Pod names and IPs change on every replacement and rollout. Never hardcode Pod IPs or store durable state on a Pod’s local filesystem.
- Stick to one management model: If you deploy with
kubectl applyor GitOps, avoid mixing in imperativeset imageorrollout undocommands. If you must run an emergency rollback, sync the Git manifest immediately afterward. - Define readiness before trusting zero-downtime rollouts: A RollingUpdate without
readinessProbecan terminate old Pods before new application instances are ready to serve requests. - Clean up isolated test namespaces: When you finish experimenting on a local
kindcluster, delete the namespace (kubectl delete namespace lab-d4-workloads) to keep the shared lab cluster clean.