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

Conversation

T-Lakshmi
Copy link
Contributor

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 19, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign princesso for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the language/en Issues or PRs related to English language label Sep 19, 2024
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 19, 2024
Copy link

netlify bot commented Sep 19, 2024

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit e661ab0
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/66ecf727b594800007af69ee
😎 Deploy Preview https://deploy-preview-48001--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@T-Lakshmi
Copy link
Contributor Author

/sig node
/kind documentation

@k8s-ci-robot k8s-ci-robot added sig/node Categorizes an issue or PR as relevant to SIG Node. kind/documentation Categorizes issue or PR as related to documentation. labels Sep 19, 2024
@T-Lakshmi
Copy link
Contributor Author

Preview page

Hi @dipesh-rawat, @Princesso,
Pinging for review, PTAL!

@bart0sh
Copy link
Contributor

bart0sh commented Sep 19, 2024

/cc @haircommander @esotsal

### 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 *


{{< caution >}}
Container garbage collection is deprecated infavour of `--eviction-hard` or
`--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*

@haircommander
Copy link
Contributor

thanks! content wise it looks good, I just have a couple of stylistic nits

@T-Lakshmi
Copy link
Contributor Author

@haircommander,
Thanks for the review and suggestions.
I have updated the content with your suggestions, PTAL!

@esotsal
Copy link

esotsal commented Sep 20, 2024

Thanks
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 20, 2024
@T-Lakshmi
Copy link
Contributor Author

Thnks for the review @haircommander, @esotsal

/assign @Princesso
Assigning to @Princesso for approval, PTAL!

Copy link
Contributor

@sftim sftim left a comment

Choose a reason for hiding this comment

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

This does need an update before we can merge it, to make sure the heading is right.

/lgtm cancel

Comment on lines +169 to +175
### Container garbage collection {#container-image-garbage-collection} (deprecated)

{{< caution >}}
Container garbage collection is deprecated in favour of `--eviction-hard` or
`--eviction-soft` and will be removed in a future version. For more details on
eviction policy, see [node-pressure-eviction](/docs/concepts/scheduling-eviction/node-pressure-eviction/).
{{< /caution >}}
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.

These command line arguments are deprecated, and the format isn't right.
We also avoid statements about the future, although we do make reasonable exceptions to that general guidance.

Try this:

Suggested change
### Container garbage collection {#container-image-garbage-collection} (deprecated)
{{< caution >}}
Container garbage collection is deprecated in favour of `--eviction-hard` or
`--eviction-soft` and will be removed in a future version. For more details on
eviction policy, see [node-pressure-eviction](/docs/concepts/scheduling-eviction/node-pressure-eviction/).
{{< /caution >}}
### Legacy garbage collection for containers (deprecated) {#container-image-garbage-collection}
{{< feature-state for_k8s_version="v1.9" state="deprecated" >}}
{{< note >}}
Container garbage collection is deprecated, in favor of using the kubelet configuration file
entries `evictionHard` and `evictionSoft` to manage overall Pod
{{< glossary_tooltip text="eviction" term_id="eviction" >}}.
{{< /note >}}

ℹ️ I am not sure about which version deprecated setting these command line arguments.

Am I right that eviction is always at the Pod level, whereas these deprecated settings apply at the container level?

Comment on lines 177 to +187
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`.
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.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 20, 2024
@T-Lakshmi
Copy link
Contributor Author

T-Lakshmi commented Sep 24, 2024

I think sig-node leaders may be able to clarify this.

Hello @kubernetes/sig-node-leads, @kubernetes/sig-node-bugs,
we would appreciate your feedback to ensure the accuracy of these proposed changes. Thanks!

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 24, 2024

{{< caution >}}
Container garbage collection is deprecated in favour of `--eviction-hard` or
`--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.

container gc and eviction are different things ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello @tengqm,

container gc and eviction are different things ...

Can you clarify on the below points of container gc?

  1. Is --minimum-container-ttl-duration, --maximum-dead-containers and --maximum-dead-containers-per-container related to container gc?
  2. In which version container gc got deprecated?
  3. Is there any alternate recommended way for container garbage collection? What it is?

Copy link
Contributor

Choose a reason for hiding this comment

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

Container GC is a task performed by kubelet regularly. The command line flags you mentioned are about container GC. The things that got deprecated, IIRC, are the command line flags. The intent of the deprecation was to reduce knobs for users to tune.
With the mechanism still there in kubelet, container GC won't go away any time soon. I'm not aware of anyone pushing this forward. In other words, the "deprecation" itself may get rotten (or deprecated).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for sharing feedback @tengqm.

What others say on this? Please share your opinion.

Copy link
Contributor

Choose a reason for hiding this comment

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

Container GC is a task performed by kubelet regularly. The command line flags you mentioned are about container GC. The things that got deprecated, IIRC, are the command line flags.

That looks right. Most kubelet command line arguments are deprecated (you should use the configuration file), and also the settings for container / container image GC were a bit legacy anyway.

@T-Lakshmi
Copy link
Contributor Author

/cc @kubernetes/sig-node-pr-reviews

@k8s-ci-robot
Copy link
Contributor

@T-Lakshmi: GitHub didn't allow me to request PR reviews from the following users: kubernetes/sig-node-pr-reviews.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @kubernetes/sig-node-pr-reviews

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot
Copy link
Contributor

@T-Lakshmi: GitHub didn't allow me to request PR reviews from the following users: kubernetes/sig-node-pr-reviews.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @kubernetes/sig-node-pr-reviews

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@esotsal
Copy link

esotsal commented Oct 19, 2024

/unassign

@esotsal
Copy link

esotsal commented Oct 19, 2024

I think sig-node leaders may be able to clarify this.

Hello @kubernetes/sig-node-leads, @kubernetes/sig-node-bugs, we would appreciate your feedback to ensure the accuracy of these proposed changes. Thanks!

/cc @SergeyKanzhelev @haircommander WDYT ?

@T-Lakshmi
Copy link
Contributor Author

Thanks @esotsal.

/cc @mrunalp

looping @mrunalp also for feedback.

@k8s-ci-robot k8s-ci-robot requested a review from mrunalp October 21, 2024 04:32
@T-Lakshmi
Copy link
Contributor Author

@SergeyKanzhelev
Copy link
Member

Added PR to sig node weekly meeting Agenda. https://docs.google.com/document/d/1Ne57gvidMEWXR70OxxnRkYquAoMpt56o75oZtg-OeBg/edit?tab=t.0

@SergeyKanzhelev @mrunalp @haircommander Please have a look!

Sorry, I wasn't looking at the deprecations around this in a while. It will simplify reviews if you can provide easy to check links on what and where we announced was deprecated.

I will likely have time to look at this only after KubeCon

@esotsal
Copy link

esotsal commented Nov 11, 2024

It will simplify reviews if you can provide easy to check links on what and where we announced was deprecated.

This PR was created as response to this comment discussed in sig-node some time ago. Googling i found deprecation is mentioned here With git blame found deprecation comment has been commited 7 years ago in 1.9.0 here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to documentation. language/en Issues or PRs related to English language sig/node Categorizes an issue or PR as relevant to SIG Node. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
Development

Successfully merging this pull request may close these issues.

Unclear with Container garbage collection configuration
9 participants