<p>I want to delete completed jobs in my aks cluster after certain time interval using TTL controller, but I'm unable to enable TTL controller in aks cluster, Is there any solution for this problem... Thanks in advance...</p>

harish hari
<p>TTL in AKS is available since 1.21.2 version of Kubernetes. For more look at <a href="https://github.com/Azure/AKS/issues/1634" rel="nofollow noreferrer">this github topic</a>:</p>
<blockquote>
<p>Short update on that. It is available in 1.21.2. Got the confirmation from Azure Support. So, we are currently using it.</p>
</blockquote>
<p>Make sure that you are using this or newer version. For older versions, you won't be able to run this mechanism. You can also use <a href="https://github.com/lwolf/kube-cleanup-operator" rel="nofollow noreferrer">kube-cleanup operator</a> for older versions of cluster.</p>
<p><a href="https://learn.microsoft.com/en-us/answers/questions/570446/can-we-leverage-34-terminated-pod-gc-threshold34-i.html" rel="nofollow noreferrer">Here</a> you can find information how to enable TTL on AKS cluster:</p>
<blockquote>
<p>Another way to clean up finished Jobs (either  <code>Complete</code>  or  <code>Failed</code>) automatically is to use a TTL mechanism provided by a TTL controller for finished resources, by specifying the  <code>.spec.ttlSecondsAfterFinished</code>  field of the Job.</p>
<p><a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/#clean-up-finished-jobs-automatically" rel="nofollow noreferrer">Reference</a></p>
<p>When the TTL controller cleans up the Job, it will delete the Job cascadingly, i.e. delete its dependent objects, such as Pods, together with the Job. Note that when the Job is deleted, its lifecycle guarantees, such as finalizers, will be honored.</p>
</blockquote>
<p>So this could help you to enable TTL mechanism on your cluster.</p>
