What are the differences between a container restart and deleting and recreating the pod?

6/9/2020

In kubernetes, one can have 1 pod with 1 container in it. Probes are set to monitor such a pod.

When the liveness probe says things are not going well, the container may be restarted (according to its restartPolicy).

However, a pod can also be deleted, and recreated instead.

Is there any differences between restarting a container vs deleted and re-creating the pod entirely?

Context:

I am asking this question, because I have a pod with a container that is updating some local configuration (to the container) when some rare events occur. This also happens when the pod starts up. Yet, when the container is restarted, because of the liveness probe, it seems that local changes are persisted (?).

I would expect a restarted container to be indistinguishable from a freshly created one, so what are all the differences?

-- Jiehong
kubernetes

0 Answers