How to enable "ttlAfterFinished=true" in the kubernetes cluster?

3/7/2020

After trying all possible configurations I ask here if anyone knows how to enable ttlAfterFinished=true?

I use the K8S version 1.17.1.

-- John
kubernetes

1 Answer

3/8/2020

You need to enable it via the feature gate 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

/etc/kubernetes/manifests/kube-controller-manager.yaml

and

etc/kubernetes/manifests/kube-apiserver.yaml

in the master node.

Edit both manifests files and add this line at the bottom of the command section:

- --feature-gates=TTLAfterFinished=true

After the yaml is edited and saved, the kube controller manager and the kube API Server pod will be automatically recreated with this feature enabled.

You can verify by checking logs of kube controller manager pod and you should see below

I0308 06:04:43.886097       1 ttlafterfinished_controller.go:105] Starting TTL after finished controller
-- Arghya Sadhu
Source: StackOverflow