Visitar URL original
Node lifecycle controller does not `markPodsNotReady` when the node `Ready` state changes from `false` to `unknown` · Issue #112733 · kubernetes/kubernetes · GitHub
Skip to content

Node lifecycle controller does not markPodsNotReady when the node Ready state changes from false to unknown #112733

Open

Description

@xenv

What happened?

When kubelet loses connect, the node goes into the unknown state. The node lifecycle controller marks the pod as not ready by the markPodsNotReady function because the health check status of the pod can not be obtained through kubelet. This feature is available only when node's Ready state transitions from true to unknown.

However, if the node is already in the fail state (such as a containerd failure), markPodsNotReady will not take effect if the node loses its connection at this time.

case currentReadyCondition.Status != v1.ConditionTrue && observedReadyCondition.Status == v1.ConditionTrue:
// Report node event only once when status changed.
controllerutil.RecordNodeStatusChange(nc.recorder, node, "NodeNotReady")
fallthrough
case needsRetry && observedReadyCondition.Status != v1.ConditionTrue:
if err = controllerutil.MarkPodsNotReady(ctx, nc.kubeClient, nc.recorder, pods, node.Name); err != nil {

In this case, the pod may accidentally remain ready, which may cause some network traffic to be accidentally forwarded to this node.

What did you expect to happen?

As long as the node loses its connection beyond grace time, MarkPodsNotReady should always work

How can we reproduce it (as minimally and precisely as possible)?

  1. Stop containerd and wait for the node Ready state to false
  2. Stop kubelet or shutdown the node and wait the node Ready state to unknown
  3. The pods which not be evicted on this node would be always ready

Anything else we need to know?

In the node lifecycle controller logic,MarkPodsNotReady is just triggered when a node goes from true state to an unknown state. The correct way is to trigger when the node becomes unknown state regardless of whether the node state was previously true

Kubernetes version

Details
$ kubectl version
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.15", GitCommit:"1d79bc3bcccfba7466c44cc2055d6e7442e140ea", GitTreeState:"clean", BuildDate:"2022-09-22T06:03:36Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}

Cloud provider

Details

OS version

Details
# On Linux:
$ cat /etc/os-release

$ uname -a
5.4.119-1-tlinux4-0008 #1 SMP Fri Nov 26 11:17:45 CST 2021 x86_64 x86_64 x86_64 GNU/Linux

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Install tools

Details

Container runtime (CRI) and version (if applicable)

Details

Related plugins (CNI, CSI, ...) and versions (if applicable)

Details

Activity

  1. added
    kind/bugCategorizes issue or PR as related to a bug.
    on Sep 26, 2022
  2. added
    needs-sigIndicates an issue or PR lacks a `sig/foo` label and requires one.
    needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.
    on Sep 26, 2022
  3. changed the title [-]Node lifecycle controller does not `markPodsNotReady` when the node `Ready` state changes from `fail` to `unknown`[/-] [+]Node lifecycle controller does not `markPodsNotReady` when the node `Ready` state changes from `false` to `unknown`[/+] on Sep 26, 2022
  4. answer1991 commented on Sep 26, 2022

    @answer1991
    Contributor

    /sig node

  5. added
    sig/nodeCategorizes an issue or PR as relevant to SIG Node.
    and removed
    needs-sigIndicates an issue or PR lacks a `sig/foo` label and requires one.
    on Sep 26, 2022
  6. bobbypage commented on Sep 26, 2022

    @bobbypage
    Member

    Thanks for the report and the simple repro steps. This sounds like a generalized duplicate of #109998

    /triage accepted

  7. akankshakumari393 commented on Sep 28, 2022

    @akankshakumari393
    Contributor

    /assign

  8. akankshakumari393 commented on Sep 28, 2022

    @akankshakumari393
    Contributor

    Is this a good-first-issue. I would like to work on it?

  9. SergeyKanzhelev commented on Sep 28, 2022

    @SergeyKanzhelev
    Member

    /triage accepted

  10. added
    triage/acceptedIndicates an issue or PR is ready to be actively worked on.
    and removed
    needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.
    on Sep 28, 2022
  11. SergeyKanzhelev commented on Sep 28, 2022

    @SergeyKanzhelev
    Member

    Is this a good-first-issue. I would like to work on it?

    Yes, I believe the change required is very localized.

  12. 35 remaining items

  13. ch0wdreN commented on Dec 6, 2025

    @ch0wdreN

    /assign

  14. added a commit that references this issue on Mar 7, 2026
    7df7c39
  15. ngpayyappilly commented on May 18, 2026

    @ngpayyappilly

    /assign

  16. added a commit that references this issue on Jun 12, 2026
    929f648
  17. mohitdebian commented on Aug 3, 2026

    @mohitdebian
    Contributor

    Hello! I opened PR (#141089) addressing the node lifecycle controller behavior when node readiness transitions from False to Unknown, ensuring pods are marked NotReady appropriately.

  18. aryawadhwa commented on Aug 10, 2026

    @aryawadhwa

    Hi all! I've been investigating this issue locally and found that the node lifecycle controller indeed misses the False -> Unknown transition for executing MarkPodsNotReady. I've successfully implemented a fix by updating the transition checks around line 756 in node_lifecycle_controller.go to also queue retries for currentReadyCondition.Status == v1.ConditionUnknown && observedReadyCondition.Status == v1.ConditionFalse, and falling through to execute MarkPodsNotReady. I've also added unit tests for this specific state transition which are passing. Let me know if I can raise a PR for this, or if #141089 has already addressed it!

  19. mohitdebian commented on Aug 10, 2026

    @mohitdebian
    Contributor

    Hi @aryawadhwa, thanks for looking into this! PR #141089 is already open for this and includes the state transition unit tests. I just pushed a minor refactor that also ensures the retry queues correctly on API server failures during the transition. Feel free to drop by the PR and take a look!

  20. neoLsH commented on Aug 24, 2026

    @neoLsH
    Contributor

    /assign

  21. mohitdebian commented on Aug 25, 2026

    @mohitdebian
    Contributor

    hey folks, thanks for looking into this! just a heads up that there's already an open PR (#141089) with the fix and tests for this that's currently waiting for review. feel free to drop by that PR and take a look!

  22. kpdagrt22 commented on Oct 6, 2026

    @kpdagrt22

    /assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.sig/nodeCategorizes an issue or PR as relevant to SIG Node.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions