kubernetes-jobs

How do I automatically remove completed Kubernetes jobs?

你说的曾经没有我的故事 提交于 2019-12-02 21:41:39
Is there a way to automatically remove completed jobs besides making a cronjob to clean up completed jobs? The K8s Job Documentation states that the intended behavior of completed jobs is for them to remain in a completed state until manually deleted. Because I am running thousands of jobs a day via k8s cronjobs and I don't want to keep completed jobs around. You can now set history limits, or disable history altogether, so that failed or successful jobs are not kept around indefinitely. See my answer here . Documentation is here . This is possible from version 1.12 Alpha with

Tell when Job is Complete

做~自己de王妃 提交于 2019-11-27 12:20:51
I'm looking for a way to tell (from within a script) when a Kubernetes Job has completed. I want to then get the logs out of the containers and perform cleanup. What would be a good way to do this? Would the best way be to run kubectl describe job <job_name> and grep for 1 Succeeded or something of the sort? abagshaw Since version 1.11, you can do: kubectl wait --for=condition=complete job/myjob and you can also set a timeout: kubectl wait --for=condition=complete --timeout=30s job/myjob Eric Tune You can visually watch a job's status with this command: kubectl get jobs myjob -w The -w option

Tell when Job is Complete

拟墨画扇 提交于 2019-11-26 12:42:32
问题 I\'m looking for a way to tell (from within a script) when a Kubernetes Job has completed. I want to then get the logs out of the containers and perform cleanup. What would be a good way to do this? Would the best way be to run kubectl describe job <job_name> and grep for 1 Succeeded or something of the sort? 回答1: Since version 1.11, you can do: kubectl wait --for=condition=complete job/myjob and you can also set a timeout: kubectl wait --for=condition=complete --timeout=30s job/myjob 回答2: