kubernetes: endpoint not update even if pod had deleted when node shutdown

What happened?

  1. shutdown node host, the kubelet on node enabled GracefulNodeShutdown feature
  2. endpoint which associated with pod running on this node, the endpoint is not remove after long time

What did you expect to happen?

expect the endpoint was removed finally.

when enable nodeGraceFullShutDown, the update logic about node.status.conditions.Ready is below:

+--------+         (sync)       +---------+         (async)        +---------+
|  True  +--------------------->|  false  +----------------------->| unknown |
+--------+   kubelet shutdown   +---------+   controller timeout   +---------+

when disable nodeGraceFullShutDown and do (bash)# shutdown now, the update logic about node.status.conditions.Ready is below:

+--------+         (async)        +---------+
|  True   +----------------------->| unknown |
+--------+    controller timeout   +---------+

in these situations, just handler when current condition is unkown and cache condition is ready can cover all

the monitorNodeHealth in node_lifecycle_controller only handler this situation true -> unknown. when this happend, should do MarkPodsNotReady in line https://github.com/kubernetes/kubernetes/blob/8aaea8e24c1b87dbd606801f3c3f1e51ee4da44e/pkg/controller/nodelifecycle/node_lifecycle_controller.go#L839

	case currentReadyCondition.Status != v1.ConditionTrue && observedReadyCondition.Status == v1.ConditionTrue:
		// Report node event only once when status changed.
		nodeutil.RecordNodeStatusChange(nc.recorder, node, "NodeNotReady")
		fallthrough

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

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: nginx-test
spec:
  selector:
    matchLabels:
      app: nginx-test
  template:
    metadata:
      labels:
        app: nginx-test
    spec:
      containers:
      - image: nginx:1.21
        imagePullPolicy: IfNotPresent
        name: nginx-test
      priorityClassName: system-cluster-critical
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-test
spec:
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: nginx-test
  type: ClusterIP

1 create resource daemonset and service 2 reboot or shutdown node which enable gracefuleShutDown, could check by systemd-inhibit --list 3 kubectl get ep nginx-test -w 4 the endpoint not update eventually

Anything else we need to know?

No response

Kubernetes version

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-09-06T02:30:46Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-09-06T02:30:46Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}

Cloud provider

no

OS version

# On Linux:
$ cat /etc/os-release
NAME="Cloud Linux"
VERSION="8.4 (AltArch)"
ID="escore"
ID_LIKE="rhel fedora"
VERSION_ID="8.4"

$ uname -a
Linux node-4.domain.tld 4.18.0-147.5.1.es8_22.x86_64

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

Install tools

Container runtime (CRI) and version (if applicable)

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

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 28 (24 by maintainers)

Most upvoted comments

This seems like a general issue with node lifecycle controller and is not specific to graceful shutdown. See #112733 for a similar case. If nodes Readiness goes to unknown state, it seems logical that we should also be marking pods as not ready on the node-lifecycle-controller side.