-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TTL controller for cleaning up finished resources
- Loading branch information
Showing
3 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
content/en/docs/concepts/workloads/controllers/ttlafterfinished.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
reviewers: | ||
- janetkuo | ||
title: TTL Controller for Finished Resources | ||
content_template: templates/concept | ||
weight: ?? | ||
--- | ||
|
||
{{% capture overview %}} | ||
|
||
The TTL controller provides a TTL mechanism to limit the lifetime of resource | ||
objects that have finished execution. Currently, TTL controller only handles | ||
[Jobs](/docs/concepts/workloads/controllers/jobs-run-to-completion/) for | ||
now, and may be expanded to handle other resources that will finish execution, | ||
such as Pods and custom resources. | ||
|
||
Alpha Disclaimer: this feature is currently alpha, and can be enabled with | ||
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) | ||
`TTLAfterFinished`. | ||
|
||
|
||
{{% /capture %}} | ||
|
||
|
||
{{< toc >}} | ||
|
||
|
||
{{% capture body %}} | ||
|
||
## TTL Controller | ||
|
||
The TTL controller only manages Jobs for now. You can use this feature to clean | ||
up finished Jobs (either `Complete` or `Failed`) automatically by specifying the | ||
`.spec.ttlSecondsAfterFinished` field of a Job, | ||
see [example](/docs/concepts/workloads/controllers/jobs-run-to-completion/#clean-up-finished-jobs-automatically). | ||
|
||
In the future, we plan to expand TTL controller to other resources that will | ||
finish execution, such as Pods and custom resources. | ||
|
||
### Updating TTL Seconds | ||
|
||
Note that the TTL period, e.g. `.spec.ttlSecondsAfterFinished` field of Jobs, | ||
can be modified after the resource is created or has finished. However, once the | ||
Job becomes eligible to be deleted (i.e. the TTL has expired), the system won't | ||
guarantee that the Jobs will be kept even if an update to extend the TTL returns | ||
a successful API response. | ||
|
||
### Time Skew | ||
|
||
Because TTL controller uses timestamps stored in the Kubernetes resources to | ||
determine whether the TTL has expired or not, this feature is sensitive to time | ||
skew in the cluster, which may cause TTL controller to clean up resource objects | ||
at the wrong time. | ||
|
||
In Kubernetes, it's required to run NTP on all nodes | ||
(see [#6159](https://github.com/kubernetes/kubernetes/issues/6159#issuecomment-93844058)) | ||
to avoid time skew. Clocks aren't always correct, but the difference should be | ||
very small. Please be aware of this risk when setting a non-zero TTL. | ||
|
||
{{% /capture %}} | ||
|
||
{{% capture whatsnext %}} | ||
|
||
[Clean up Jobs automatically](/docs/concepts/workloads/controllers/jobs-run-to-completion/#clean-up-finished-jobs-automatically) | ||
|
||
[Design doc](https://github.com/kubernetes/community/blob/master/keps/sig-apps/0026-ttl-after-finish.md) | ||
|
||
{{% /capture %}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters