- TechOps Examples
- Posts
- How a Pod is Deleted - Behind the Scenes Breakdown
How a Pod is Deleted - Behind the Scenes Breakdown
TechOps Examples
Hey — It's Govardhana MK 👋
Along with a use case deep dive, we identify the top news, tools, videos, and articles in the TechOps industry.
IN TODAY'S EDITION
🧠 Use Case
How a Pod is Deleted - Behind the Scenes Breakdown
🚀 Top News
DataDog released 2024 State of Cloud Security Report
Highlights:
Less than half of EC2 instances enforce IMDSv2
Long-lived credentials continue to be a major risk
79% of S3 buckets have Public Access Block enabled
Many managed Kubernetes clusters expose their API server to the internet
📽️ Videos
Fast-Forward Merges Are The Future
Stateful vs Stateless Architectures Explained
📚️ Resources
What is the Kubernetes “Claim” model?
How to Create a Secure CI/CD Pipeline Using Okta Terraform
AWS Cost Optimization: 6 Free Tools & 10 Hacks to Cut AWS Bills
TOGETHER WITH WRITER
Writer RAG tool: build production-ready RAG apps in minutes
RAG in just a few lines of code? We’ve launched a predefined RAG tool on our developer platform, making it easy to bring your data into a Knowledge Graph and interact with it with AI. With a single API call, writer LLMs will intelligently call the RAG tool to chat with your data.
Integrated into Writer’s full-stack platform, it eliminates the need for complex vendor RAG setups, making it quick to build scalable, highly accurate AI workflows just by passing a graph ID of your data as a parameter to your RAG tool.
🛠️ TOOL OF THE DAY
Litmus - helps SREs and developers practice chaos engineering in a Cloud-native way.
Multi Tenant for K8s
Chaos experiments are chained in sequence or parallel to build a scenario.
Litmus exports Prometheus metrics to quantify the impact of chaos on applications or infrastructure.
🧠 USE CASE
How a Pod is Deleted - Behind the Scenes Breakdown
When we run kubectl delete pod
, the confirmation message pops up saying the pod is deleted(if all good)
$ kubectl delete pod techops-pod
pod "techops-pod" deleted
Wondered, what happens behind the scenes?
Before diving into pod deletion behind the scenes, you should know the basics.
SIGTERM: Requests a graceful shutdown, allowing the program to finish tasks and clean up. In Kubernetes, pods get time to exit cleanly.
SIGKILL: Forces an immediate stop, with no cleanup. If a pod doesn't shut down in time after SIGTERM, Kubernetes sends SIGKILL to terminate it.
In short,
SIGTERM allows for cleanup.
SIGKILL stops everything instantly.
Pod Deletion - Behind the Scenes:
Pod deletion flow
kubectl delete pod: Triggers the API Server to update ETCD with
deletionTimestamp
anddeletionGracePeriodSeconds
, marking the pod as Terminating.API Server → Kubelet: Notifies the Kubelet of the pod’s termination.
Endpoint Controller: Removes the pod from active service endpoints, stopping any traffic from reaching the pod.
PreStop Hook (if configured): Before sending SIGTERM, the Kubelet runs the PreStop Hook. This allows the pod to perform custom tasks (e.g., closing connections) during shutdown.
SIGTERM: Kubelet sends SIGTERM, initiating a graceful shutdown. The pod is given the
deletionGracePeriodSeconds
(default 30s) to cleanly exit.Graceful Shutdown: During the grace period, the pod handles any ongoing tasks, such as completing requests or saving data, before it fully stops.
SIGKILL: If the pod doesn't terminate within the grace period, SIGKILL is sent, forcing immediate shutdown.
Pod Deleted: The API Server updates ETCD, marking the pod as deleted. Components like Kube-Proxy, Ingress, and others remove all references to the pod.
Here are some common signals for your knowledge (though out of context):
SIGHUP: Hangup signal
SIGINT: Interrupt signal (triggered by Ctrl+C)
SIGQUIT: Quit signal
SIGSTOP: Stop the process (cannot be caught or ignored)
I hope this was helpful in your learning journey.
You may even like:
Over the past 17+ years, I’ve led millions of dollars' worth of digital and cloud transformation projects for 40+ clients, including:
I can help you kickstart your digital and cloud transformation or optimize your existing systems to make them more efficient, scalable, and future-ready.
Whenever you’re ready for that, book a call.