<p>After trying all possible configurations I ask here if anyone knows how to enable <code>ttlAfterFinished=true</code>? </p>

<p>I use the K8S version 1.17.1.</p>

Hanif Tadjik
<p>You need to enable it via the <strong>feature gate</strong> in kube controller manager and kube API Server. If Kube controller manager and kube API Server is deployed as static pod then you can find the deployment yaml at</p>
<p><code>/etc/kubernetes/manifests/kube-controller-manager.yaml</code></p>
<p>and</p>
<p><code>/etc/kubernetes/manifests/kube-apiserver.yaml</code></p>
<p>in the <strong>master</strong> node.</p>
<p>Edit both manifests files and add this line at the bottom of the command section:</p>
<pre><code>- --feature-gates=TTLAfterFinished=true
</code></pre>
<p>After the yaml is edited and saved, the kube controller manager and the kube API Server pod will be <strong>automatically</strong> recreated with this feature enabled.</p>
<p>You can verify by checking logs of kube controller manager pod and you should see below</p>
<pre><code>I0308 06:04:43.886097       1 ttlafterfinished_controller.go:105] Starting TTL after finished controller
</code></pre>
<p>Tip: you can specify multiple feature gates using comma, for example:</p>
<pre><code>--feature-gates=TTLAfterFinished=true,OtherFeature=true
</code></pre>
