1

I know that a pod may die for various reasons. For example in case of a node failure the pod is lost.

However I can't find an answer to this question: are there any cases where the pod is alive and it gets killed on purpose by the deployment that created it?

The only thing I can think about is scaling (e.g. scale down). Are there any other cases?

Basically I would like to understand if a bare pod has usually a longer live compared to a deployment pod or if the probability to die is the same.

1

A bare pod and is exactly the same as a pod created by a deployment, the difference is that the deployment automates several tasks that you would have to execute manually.

deployments, daemonsets, statefulsets, jobs and cronjobs are all pod managers, they all create/delete pods under the hood.

Let's say you have a service sending requests to a pod running nginx containers that serve your site and you want to update the new container image that has the new files.

steps:

  1. create a new pod with the updated image
  2. portforward to it and check if the pod is up and nginx is responding to requests
  3. add the labels that the service will look for
  4. delete the old pod

sounds good? that's exactly what the deployment will do if you just update the image directly on it.

You can have some resilience built into pods with pod lifecycle, which will attempt to restart the containers, but there's a limit to it, and managing changes and scaling pods manually is awful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.