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

apiVersion: v1
kind: pod
  name: app-pod
  - name: app-container
    image: busybox
  terminationGracePeriodSeconds: 60

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.

Last updated