☸️ Visual Guide: Kubernetes Object Lifecycle — From Creation to Termination
Kubernetes is all about declarative infrastructure — you describe what you want, and Kubernetes figures out how to get there. But what actually happens behind the scenes when you create, update, or delete an object like a Pod or Deployment?
In this visual guide, we’ll walk through the full lifecycle of Kubernetes objects — including creation, scheduling, management, and garbage collection — covering beginner to advanced concepts.

🧱 What Is a Kubernetes Object?
A Kubernetes object is a “record of intent” — it tells the cluster what you want.
Examples:
Pod
— a single unit of container executionDeployment
— declarative app rollout controllerService
— exposes Pods to the networkIngress
— routes external HTTP(S) trafficConfigMap
/Secret
— external configs or credentials
All objects share a common lifecycle pattern.
🚀 Phase 1: Object Creation
📝 Step 1: Define YAML
You define your object in a .yaml
file.
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- name: nginx
image: nginx:latest
⏎ Step 2: Submit via kubectl
kubectl apply -f my-pod.yaml
🔍 What Happens:
- YAML is converted into a JSON object
- Sent via HTTP to the Kubernetes API Server
- The API server authenticates and validates the object
- It stores the object in etcd, the cluster’s key-value store
✅ Object is now “declared” in the cluster state
⚙️ Phase 2: Scheduling & Instantiation
🧠 Step 3: Scheduler Picks a Node
- Kube-Scheduler scans for unscheduled Pods
- It chooses the best node based on:
- Available CPU/RAM
- Taints/tolerations
- Node affinity/anti-affinity
- Pod priority
- Adds a
nodeName
field to the Pod spec
🤖 Step 4: Kubelet Installs the Pod
- Kubelet on the target node pulls the container image
- Starts the container using container runtime (containerd, CRI-O)
- Mounts volumes and sets up networking
✅ Pod is now running!
🔄 Phase 3: Management & Reconciliation
🔄 Step 5: Controllers Kick In
- ReplicaSet Controller ensures desired replicas
- Deployment Controller manages updates/rollbacks
- Service Controller updates endpoints
- Horizontal Pod Autoscaler adjusts pod count if needed
Kubernetes uses the control loop model:
Repeatedly checks: “Does the current state match the desired state?”
If not → take action
🧠 Advanced State Tracking (Controller Managers)
Controller | What It Does |
---|---|
Deployment | Manages rollouts and rollbacks |
ReplicaSet | Ensures correct number of pods |
DaemonSet | Ensures a pod on every node |
Job/CronJob | Runs batch or scheduled tasks |
StatefulSet | Runs ordered, unique pod instances (like DBs) |
🔐 Phase 4: Access, Monitoring, and Events
🛡️ Role-Based Access Control (RBAC)
Every object is accessed through API Server → RBAC ensures:
- Who can read/write
- Namespace isolation
- Audit logging
📈 Events and Conditions
Kubernetes continuously emits events:
kubectl describe pod my-pod
Events help debug why:
- A Pod is pending
- An image failed to pull
- A container crashed
🧹 Phase 5: Updates & Deletion
✏️ Update an Object
kubectl apply -f updated-pod.yaml
Kubernetes compares old vs new spec:
- If changes require Pod restart → it deletes and re-creates
- If it’s a rolling update (like Deployment) → it replaces gradually
❌ Delete an Object
kubectl delete -f my-pod.yaml
Deletion triggers:
- Graceful shutdown via SIGTERM
- Waits for terminationGracePeriodSeconds
- Then sends SIGKILL
- Kubelet deletes the pod from the node
- Controller removes metadata from etcd
📦 Full Kubernetes Object Lifecycle Summary
1. kubectl apply → API Server validates → etcd stores object
2. Scheduler finds best node
3. Kubelet pulls image & runs container
4. Controllers reconcile desired vs actual state
5. Pod runs, gets exposed via Services/Ingress
6. Logs/metrics are collected via sidecars or agents
7. Updates trigger graceful replacements
8. kubectl delete → triggers termination and cleanup
🧰 Bonus: Tips to Master Object Lifecycle
Task | Tool |
---|---|
Visualize objects | kubectl get all , Lens IDE |
Audit object history | kubectl describe or kubectl get -o yaml |
Track events | kubectl get events |
Debug errors | kubectl logs , kubectl exec |
Customize | metadata.labels , annotations , finalizers |
🏁 Final Thoughts
Understanding the Kubernetes object lifecycle isn’t just academic — it’s critical for debugging, optimizing performance, and designing reliable systems.
Whether you’re a beginner deploying your first Pod or an architect building microservices at scale, the object lifecycle is the heartbeat of Kubernetes.
Know the flow. Debug with clarity. Scale with confidence.
Leave a Reply