I often get confused between pod restart or container restart.
What I have understood so far is a pod restart containers according to the restart policy set on the container. I haven’t seen anything similar on a pod spec like restart policy on the Pod.
Either Pod gets created (newly) or rescheduled (deleted and then recreated).
On many occasions, I have found mentioned pod restart on Kodekloud sites.
Please correct me if I am wrong. There might be some subtle difference that I am not able to get.
The spec of a Pod has a restartPolicy field with possible values Always, OnFailure, and Never. The default value is Always.
The restartPolicy applies to all containers in the Pod. restartPolicy only refers to restarts of the containers by the kubelet on the same node. After containers in a Pod exit, the kubelet restarts them with an exponential back-off delay (10s, 20s, 40s, …), that is capped at five minutes. Once a container has executed for 10 minutes without any problems, the kubelet resets the restart backoff timer for that container.
Pod conditions
A Pod has a PodStatus, which has an array of PodConditions through which the Pod has or has not passed:
PodScheduled : the Pod has been scheduled to a node.
ContainersReady : all containers in the Pod are ready.
Initialized : all init containers have completed successfully.
Ready : the Pod is able to serve requests and should be added to the load balancing pools of all matching Services.
So yes pods don’t have anything similar to container restart policies.
For more information, you check the official documentation for K8s.