title: Kubernetes: maximum pod lifetime
body: <p>I use Kubernetes 1.6 and Docker to deploy instances/pods of a microservice.</p>
  
  <p>I have a service that needs to regularly pull continuously updated data from an external repository. This update can be triggered manually on runtime, but the service is unusable during that time. Furthermore, the up-to-date data is always retrieved on startup, so that the freshly started service instance has the most recent external data.</p>
  
  <p>Therefore, I would like to automatically create a fresh pod every hour (or some other frequency), and then kill the old pod.</p>
  
  <p>Conceptually, it seems like I should just configure a maximum lifetime per pod in the deployment, so that Kubernetes starts a new instance/pod and kills the old one if the maximum lifetime has expired, while making sure that there is always at least on pod running.
  However, <a href="https://github.com/kubernetes/kubernetes/issues/829" rel="noreferrer">Kubernetes does not seem to provide a maximum pod lifetime</a>.</p>
  
  <p>Also, due to the data update during startup, starting the pod takes 1-2 minutes before it gets ready.</p>