How long are completed pod logs stored in Kubernetes?

4/27/2017

I was trying out the CronJob resource (apiVersion: batch/v2alpha1) type in Kubernetes 1.5.2 and noticed that it create a lot of pods with status "Completed". I also noticed that I was able to view the logs of all those completed pods. This got me worried that those logs would keep accumulating forever, eating disk space. Are those pods ever garbage collected?

-- Olivier Lalonde
kubernetes

1 Answer

4/27/2017

Reading the docs, it looks like this is configurable per cronjob through history limits (.spec.successfulJobsHistoryLimit and .spec.failedJobsHistoryLimit), but it's only available in Kubernetes > v1.6: https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#jobs-history-limits

-- Olivier Lalonde
Source: StackOverflow