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

KEP-4212: Declarative Node Maintenance #4213

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

atiratree
Copy link
Member

@atiratree atiratree commented Sep 15, 2023

  • One-line PR description: introduce a NodeMaintenance API to solve various node drain issues
  • Other comments:

TODO:

  • explore permission model for NodeMaintenance, Node, Pods (RBAC, ValidatingAdmissionPolicy) and all of the actors
  • explore whether NodeMaintenance can be used as a replacement or superset of the Graceful Node Shutdown feature
  • explore possible interactions with Kubelet
  • explore the descheduling aspects of this feature
  • explore the DaemonSets and StatefulSets use case
  • figure out the best format/implementation for the EvacuationRequest

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

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: atiratree
Once this PR has been reviewed and has the lgtm label, please assign janetkuo 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 kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory sig/apps Categorizes an issue or PR as relevant to SIG Apps. labels Sep 15, 2023
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 15, 2023
@atiratree atiratree marked this pull request as draft September 15, 2023 10:46
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 15, 2023
@atiratree atiratree mentioned this pull request Sep 15, 2023
4 tasks
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.

Thank you very much for opening the issue and PR!

I know this is draft; I've got some feedback already, and I hope it's helpful.

keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
keps/sig-apps/4212-improve-node-maintenance/README.md Outdated Show resolved Hide resolved
@atiratree atiratree force-pushed the improve-node-maintenance branch 7 times, most recently from 0ed835a to 81b4589 Compare September 22, 2023 18:10
@atiratree atiratree force-pushed the improve-node-maintenance branch 2 times, most recently from 6194058 to 00dc7c5 Compare September 25, 2023 14:09
@atiratree atiratree changed the title KEP-4212: Improve Node Maintenance KEP-4212: Declarative Node Maintenance Sep 25, 2023
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.

🤔 should this be SIG Node rather than SIG Apps?

@atiratree
Copy link
Member Author

atiratree commented Oct 13, 2023

🤔 should this be SIG Node rather than SIG Apps?

Not sure yet, the API itself is SIG Node I guess, but it has a lot of implications for SIG- Apps. Let's delay this decision after I redo the KEP and we have additional rounds of discussions.

termination.NodeMaintenance could then be used even by spot instances.

The NodeMaintenance object could survive kubelet restarts, and the kubelet would always know if the
node is under shutdown (maintenance). The cluster admin would have to remove the NodeMaintenance

Choose a reason for hiding this comment

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

Would the shutdown cancellation work in the same way as it currently is under Graceful Node Shutdown? I assume, yes, it would.

Copy link
Contributor

Choose a reason for hiding this comment

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

This KEP also supports node maintenance for Windows nodes, where graceful shutdown handling is (AIUI) not implemented.

Choose a reason for hiding this comment

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

No, it's not—very much Linux, not even other *nix, centric indeed. Would this be a blocker then for this KEP to move forward?

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO you can mark a node as needing maintenance even if it doesn't run systemd (either Linux without systemd, or Windows which doesn't really have an init process in the POSIX sense). So this KEP can move forward whether or not your nodes gracefully handle a shutdown signal.

Copy link
Member Author

Choose a reason for hiding this comment

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

Cancelation by kubelet

Note:
There are cases when Node termination was cancelled by the system (or perhaps manually by an administrator). In either of those situations the Node will return to the Ready state. However, Pods which already started the process of termination will not be restored by kubelet and will need to be re-scheduled.

Is the node termination cancellation reliable? Can we use it for deletion of the NodeMaintenance?


Also the behavior is application specific, when the the NodeMaintenance is cancelled/deleted (please see the Evacuation KEP). The application/evacuator can terminate the pod or it can also recover.


If there is no connection to the apiserver (apiserver down, network issues, etc.) and the
NodeMaintenance object cannot be created, we would fall back to the original behavior of Graceful
Node Shutdown feature. If the connection is restored, we would stop the Graceful Node Shutdown and

Choose a reason for hiding this comment

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

It might be too late to fallback to something else. We should attempt to add NodeMaintenance object, should it be missing, but it might be too late to stop Graceful Node Shutdown, which might be too far gone, so to speak. This would be a one-way? hard? fallback.

Choose a reason for hiding this comment

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

Alternatively, perhaps then doing nothing or refusing to carry-out a shutdown would be a safer option?

That said, depends on how the shutdown was triggered: if it was due to external factors (which would be the default modus operandi for which Graceful Node Shutdown has been designed), then it would be potentially unsafe to interrupt the ongoing shutdown, or there might be not enough time, etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

It would be too late for the pods that are already terminating. But it might be useful for the running non-terminated pods, right?

It seems to me that by default it would be good to carry out the Graceful Node Shutdown in the disconnected scenario. At least to have a softer landing in bad situations. I wonder if it would make sense to make this behavior configurable?

Choose a reason for hiding this comment

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

we would fall back to the original behavior of Graceful Node Shutdown feature

does this imply that Graceful Node Shutdown will be used the way it is now? or does it mean DNM will internally reproduce the same original GracefulNodeShutdown and just perform that behavior?

Copy link
Contributor

Choose a reason for hiding this comment

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

AIUI, DNM is about marking the node as needing maintenance and barely overlaps with node shutdown handling.

The only overlap is that both things trigger a node drain; but other things could also trigger that, such as node problem detector deciding the node is irreparably faulty.

@atiratree atiratree force-pushed the improve-node-maintenance branch 2 times, most recently from e733a22 to 54ef958 Compare May 17, 2024 17:42
@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. and removed cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory sig/apps Categorizes an issue or PR as relevant to SIG Apps. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

None yet