Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated container garbage collection with accurate information #48001

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions content/en/docs/concepts/architecture/garbage-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,25 @@ is restarted, the tracked image age is reset, causing the kubelet to wait the fu
based on image age.
{{< /note>}}

### Container garbage collection {#container-image-garbage-collection}
### Container garbage collection {#container-image-garbage-collection} (deprecated)

{{< caution >}}
Container garbage collection is deprecated infavour of `--eviction-hard` or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in favour *

`--eviction-soft` and Will be removed in a future version. For more details on
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will*

eviction policy, see [node-pressure-eviction](/docs/concepts/scheduling-eviction/node-pressure-eviction/).
{{< /caution >}}

The kubelet garbage collects unused containers based on the following variables,
which you can define:

* `MinAge`: the minimum age at which the kubelet can garbage collect a
container. Disable by setting to `0`.
* `MaxPerPodContainer`: the maximum number of dead containers each Pod
can have. Disable by setting to less than `0`.
* `MinAge`: the minimum age at which the kubelet can garbage collect a container.
Disable by setting a kubelet config flag `--minimum-container-ttl-duration` to `0`.
* `MaxPerPodContainer`: the maximum number of dead containers each Pod can have.
Disable by setting a kubelet config flag `--maximum-dead-containers-per-container`
to less than `0`.
* `MaxContainers`: the maximum number of dead containers the cluster can have.
Disable by setting to less than `0`.
Disable by setting a kubelet config flag `--maximum-dead-containers`
to less than `0`.
Comment on lines 177 to +187
Copy link
Contributor

@sftim sftim Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right?

Suggested change
The kubelet garbage collects unused containers based on the following variables,
which you can define:
* `MinAge`: the minimum age at which the kubelet can garbage collect a
container. Disable by setting to `0`.
* `MaxPerPodContainer`: the maximum number of dead containers each Pod
can have. Disable by setting to less than `0`.
* `MinAge`: the minimum age at which the kubelet can garbage collect a container.
Disable by setting a kubelet config flag `--minimum-container-ttl-duration` to `0`.
* `MaxPerPodContainer`: the maximum number of dead containers each Pod can have.
Disable by setting a kubelet config flag `--maximum-dead-containers-per-container`
to less than `0`.
* `MaxContainers`: the maximum number of dead containers the cluster can have.
Disable by setting to less than `0`.
Disable by setting a kubelet config flag `--maximum-dead-containers`
to less than `0`.
The kubelet garbage collects dead containers within existing Pods. This garbage collection is
based on the values for several related command line arguments, that are all deprecated:
`--minimum-container-ttl-duration`
: the minimum age at which the kubelet can garbage collect a dead container. Disable by setting to 0. Setting a value for `--minimum-container-ttl-duration` is deprecated.
`--maximum-dead-containers`
: limits the total number of dead containers for this node. The default is unlimited. You can set this to an integer that is zero or higher in order to set legacy dead container limits, node-wide. Setting a value for `--maximum-dead-containers` is deprecated.
`--maximum-dead-containers-per-container`: the maximum number of dead containers each Pod
can have. The default value for this setting is 1; however, you can specify unlimited dead containers by setting this value to 0. Note that setting a value for `--maximum-dead-containers-per-container` is deprecated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I agree we should refer folks to the kubelet configuration options as we're redirecting folks away from using the CLI

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT ^ @T-Lakshmi ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haircommander,
Yes, I also agree to mention about CLI usage of these arguments.

But my concern is the below statement is true or not?

Container garbage collection is deprecated in favour of --eviction-hard or --eviction-soft and will be removed in a future version.

also when container GC got deprecated and what are the recommended way to use as alternate to container GC?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here it mentioned old logs are stored outside of container's context.

Is that true? if true, in which location old logs are storing now?
Please share your inputs.


In addition to these variables, the kubelet garbage collects unidentified and
deleted containers, typically starting with the oldest first.
Expand Down