SEASON 3
How Kubernetes pod get terminated
A stage by stage transition

1 State change and preparation

The pod is set to Terminating. And it will be isolated from end points

2 Run a preStop Hook

preStopHook will be executed. It is special command or http request sent to containers in the pod.

3 SIGTERM signal is sent to the pod

Kubernetes sends SIGTERM signal to all the containers in the pod. This lets them know that they are going to be terminated. SIGTERM can be handled, or ignored.

4 Kuberntes waits for the grace period

1
apiVersion: v1
2
kind: pod
3
metadata:
4
name: app-pod
5
spec:
6
containers:
7
- name: app-container
8
image: busybox
9
terminationGracePeriodSeconds: 60
Copied!

5 Kubernetes sends SIGKILL command

If the containers are still running it sends SIGKILL command. Kubernetes cleanup all the objects related to the terminated pod.
Copy link
Edit on GitHub
Contents