0
0
Kubernetesdevops~10 mins

Deleting Pods in Kubernetes - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Deleting Pods
Identify Pod to delete
Run kubectl delete pod <pod-name>
API Server receives request
Pod deletion process starts
Pod status changes to Terminating
Pod resources cleaned up
Pod removed from cluster
Done
This flow shows how a pod is deleted step-by-step from issuing the command to the pod being removed from the cluster.
Execution Sample
Kubernetes
kubectl delete pod my-pod
kubectl get pods
Deletes the pod named 'my-pod' and then lists all pods to confirm deletion.
Process Table
StepCommandActionPod StatusOutput
1kubectl delete pod my-podSend delete request to API servermy-pod: RunningDeletion request accepted
2API ServerMark pod as Terminatingmy-pod: TerminatingPod marked for deletion
3KubeletClean up pod resourcesmy-pod: TerminatingResources cleaned
4API ServerRemove pod from clustermy-pod: RemovedPod removed
5kubectl get podsList current podsmy-pod: Not foundNo pods named my-pod
💡 Pod 'my-pod' is deleted and no longer appears in pod list.
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4Final
Pod StatusRunningRunningTerminatingTerminatingRemovedRemoved
Key Moments - 2 Insights
Why does the pod status change to 'Terminating' instead of disappearing immediately?
The pod status changes to 'Terminating' (see execution_table step 2) because Kubernetes first cleans up resources and gracefully stops the pod before removing it completely.
What happens if you run 'kubectl get pods' immediately after deletion?
You may still see the pod in 'Terminating' status briefly (deletion is asynchronous and takes a moment to complete).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the pod status right after the delete command is sent?
ADeleted
BRunning
CTerminating
DPending
💡 Hint
Check the 'Pod Status' column at Step 1 in the execution_table.
At which step is the pod actually removed from the cluster?
AStep 2
BStep 3
CStep 4
DStep 5
💡 Hint
Look for the step where 'Pod removed' appears in the 'Output' column.
If the pod cleanup takes longer, which status will you see when running 'kubectl get pods'?
ATerminating
BRunning
CDeleted
DUnknown
💡 Hint
Refer to the 'Pod Status' during Steps 2 and 3 in the execution_table.
Concept Snapshot
Deleting Pods in Kubernetes:
- Use 'kubectl delete pod <pod-name>' to delete a pod.
- Pod status changes from Running to Terminating.
- Kubernetes cleans up resources before final removal.
- Pod disappears from 'kubectl get pods' after deletion completes.
- Deletion is asynchronous and may take a few seconds.
Full Transcript
Deleting a pod in Kubernetes starts by running the command 'kubectl delete pod <pod-name>'. This sends a request to the API server, which marks the pod as Terminating. The kubelet then cleans up the pod's resources. Once cleanup finishes, the pod is removed from the cluster and no longer appears in pod listings. The pod status changes step-by-step from Running to Terminating, then it is removed. This process is asynchronous, so the pod may still appear briefly after deletion is requested.