<p>Currently we have a CronJob to clean pods deployed by airflow.
Cleanup cron job in airflow is defined as follows
<a href="https://i.stack.imgur.com/1ZsWx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1ZsWx.png" alt="enter image description here" /></a></p>
<p>This Cleans all completed pods (Successful pod and Pods that are marked as Error).</p>
<p>I have a requirement where in CleanUp Pods CronJob shouldn't clean Pods that are marked as <strong>ERROR</strong>.
I checked Airflow Docs but couldn't get anything. Any other way in which i can achieve this</p>

user3865748
<p>There are 2 airflow environments variables that might help.</p>
<p>AIRFLOW__KUBERNETES__DELETE_WORKER_PODS - If True, all worker pods will be deleted upon termination</p>
<p>AIRFLOW__KUBERNETES__DELETE_WORKER_PODS_ON_FAILURE - If False (and delete_worker_pods is True), failed worker pods will not be deleted so users can investigate them. This only prevents removal of worker pods where the worker itself failed, not when the task it ran failed</p>
<p>for more details see <a href="https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#delete-worker-pods-on-failure" rel="nofollow noreferrer">here</a></p>
