Answers: <p>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.</p>
  <p>deployments, daemonsets, statefulsets, jobs and cronjobs are all pod managers, they all create/delete pods under the hood.</p>
  <p>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.</p>
  <p>steps:</p>
  <ol>
  <li>create a new pod with the updated image</li>
  <li>portforward to it and check if the pod is up and nginx is responding to requests</li>
  <li>add the labels that the service will look for</li>
  <li>delete the old pod</li>
  </ol>
  <p>sounds good? that's exactly what the deployment will do if you just update the image directly on it.</p>
  <p>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.</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-11-15T02:25:44.563Z
Answers: 2021-11-15T02:25:44.563Z
Answers: Magus
Body: <p>I know that a pod may die for various reasons. For example in case of a node failure the pod is lost.</p>
  <p>However I can't find an answer to this question: <strong>are there any cases where the pod is alive and it gets killed on purpose by the deployment that created it?</strong></p>
  <p>The only thing I can think about is scaling (e.g. scale down). Are there any other cases?</p>
  <p>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.</p>
  
Tags: <kubernetes>
Title: Kubernetes: when does a deployment kill its pods?
UserDisplayName: collimarco
ThreadText: # Kubernetes: when does a deployment kill its pods?
  
  (Asked by: username_0 on 2021-11-09)
  
  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.
  
  **Tags:** kubernetes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-11-15. Score: 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.
  
  
  ---
  
  