We clean up pods with completed status manually. Is there a way to automate cleaning up pods that have completed status?
Extending Yuwei's answer:
There is no built-in option to automate such "garbage collection", that's why there is a workaround to make a simple script of kubectl
command by using timeout
command. Here you can find the article on How to use Timeout command.
So it will be something like this:
timeout -s9 300m kubectl delete pod --field-selector status.phase=Succeeded -A
or
timeout -s9 300m kubectl delete job <job-name>