Answers: <p>So both <code>cronjob.spec.jobTemplate.spec.template.spec.restartPolicy</code> and <code>cronjob.spec.jobTemplate.spec.backoffLimit</code> influence such restarts. Setting the 2nd one to 0 (and keeping the 1st one at <code>Never</code>) brought about the desired behavior.</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-06-23T16:53:39.850Z
Answers: 2021-06-23T16:53:39.850Z
Answers: rookie099
Body: <p>I have a <code>cronjob</code> with <code>cronjob.spec.jobTemplate.spec.template.spec.restartPolicy=Never</code>. And I am using <code>kubectl create job --from=cronjob/my_cronjob my_test</code> for manually starting an instance outside the schedule.</p>
  <p>What I am observing is that subsequent instances of the resulting <code>pod</code> start after the first one has resulted in an error. The jobs <code>job.spec.template.spec.restartPolicy</code> and the pods' <code>pod.spec.restartPolicy</code> are also <code>Never</code> (as expected), so what could bring these restarts about?</p>
  
Tags: <kubernetes>
Title: Surprising restarts of Kubernetes pods despite restartPolicy=Never
UserDisplayName: rookie099
ThreadText: # Surprising restarts of Kubernetes pods despite restartPolicy=Never
  
  (Asked by: username_0 on 2021-06-23)
  
  I have a `cronjob` with `cronjob.spec.jobTemplate.spec.template.spec.restartPolicy=Never`. And I am using `kubectl create job --from=cronjob/my_cronjob my_test` for manually starting an instance outside the schedule.
  
  What I am observing is that subsequent instances of the resulting `pod` start after the first one has resulted in an error. The jobs `job.spec.template.spec.restartPolicy` and the pods' `pod.spec.restartPolicy` are also `Never` (as expected), so what could bring these restarts about?
  
  **Tags:** kubernetes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2021-06-23. Score: 1 | Accepted answer
  
  So both `cronjob.spec.jobTemplate.spec.template.spec.restartPolicy` and `cronjob.spec.jobTemplate.spec.backoffLimit` influence such restarts. Setting the 2nd one to 0 (and keeping the 1st one at `Never`) brought about the desired behavior.
  
  
  ---
  
  