Will Container receive signal (SIGTERM) when it is NOT_READY state

681 Views Asked by At

Consider I have 10 containers in my POD.

I have added startUpProbe for 3 containers.

If I delete my POD, before Probe is completed sucessfully (Which means those containers are not in READY state)

Deleting Pod should send SIGTERM signal to all the containers to down it gracefully.

Will SIGTERM send to 3 containers where am using probes that are not yet completed ?

1

There are 1 best solutions below

6
Kranthiveer Dontineni On

The blog Troubleshooting SIGTERM: graceful termination of Linux containers written by James Walker details about SIGTERM and how to leverage it in your application so that it can terminate without corrupting any data.

SIGTERM is a Linux signal that Unix-based operating systems issue when they want to terminate a running process. In normal circumstances, your application should respond to a SIGTERM by running cleanup procedures that facilitate graceful termination. If processes aren’t ready to terminate, they may elect to ignore or block the signal.

So, when a pod is deleted the SIGTERM signal is sent to all the containers irrespective of their state and the pod will wait till the graceful termination period(which is 30s by default), once the graceful period ends SIGKILL signal will be sent which will forcefully terminates all the processes. Since your containers are having startUpProbe enabled they will be in the pending state when the SIGTERM signal is generated and can continue the process till the graceful termination period ends, then they will get terminated by the SIGKILL signal. (reference: kubernetes docs)