How are pods in completed Kubernetes jobs deleted?

6/21/2019

I'm running a Kubernetes job, and was trying to look at the logs for it hours after it had been completed. However, when I did kubectl describe job [jobname], no pods were listed (Events came back as just <none>), and when I did kubectl get pods, the pod for that job was not there. How would the deletion of pods in completed jobs be configured, and how could I change that to let the pod stay up longer so I can read its logs?

-- Andy Haskell
kubernetes

1 Answer

6/21/2019

Look at the properties below. Below setting would keep 3 jobs in the history that were successful. You would have one failed job history. You can change the count as per your need

successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 1
-- P Ekambaram
Source: StackOverflow