liveBook · Manning

ttlSecondsAfterFinished field

As explained in Kubernetes in Action, Second Edition

The ttlSecondsAfterFinished field is a Kubernetes Job specification field that defines how long a finished Job and its pods are retained before automatic deletion.

The ttlSecondsAfterFinished field tells Kubernetes how long to retain a finished Job and its pods before deleting them automatically. Without it, Job objects require manual deletion. section 18.1.1

A ten-second retention window

A Job runs one pod that completes successfully after 20 seconds. With ttlSecondsAfterFinished set to 10, Kubernetes deletes the Job and its pod 10 seconds after completion. section 18.1.1

The cleanup applies whether the Job succeeds or fails. Set the retention period long enough to inspect logs from failed pods; otherwise deletion can remove evidence needed for diagnosis. section 18.1.1

How Kubernetes in Action, Second Edition covers it

How deep it goes
Defines retention timing and failure-related consequences, but does not detail controller implementation.
Examples
Uses a single-pod Job that completes after 20 seconds and is deleted 10 seconds later.
What you can do after
Operate/configure Job retention and preserve enough time to inspect failed-pod logs.
How it connects
Connects Job completion with pods, garbage collection, and pod logs.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.