kubernetes: HTTP2_PING_TIMEOUT_SECONDS+HTTP2_READ_IDLE_TIMEOUT_SECONDS > 40s will cause all node NotReady
What happened?
The controller-manager node-lifecycle-controller watches node lease and update nodeHealthMap probeTimestamp , and it check node probeTimestamp is before now - node-monitor-grace-period. The node-monitor-grace-period default value is 40s.
When the client connection lost, the lease watcher cannot receive new event. With the http2 health check, HTTP2_PING_TIMEOUT_SECONDS default is 30s, HTTP2_READ_IDLE_TIMEOUT_SECONDS default is 15s, it will delay 45s to kill http2 connection.
During this period, node-lifecycle-controller will mark all nodes NotReady.
Here are some logs
I1103 23:00:28.464015 1 node_lifecycle_controller.go:1097] node 10.0.10.240 hasn't been updated for 40.010894415s. Last Ready is: &NodeCondition{Type:Ready,Status:True,LastHeartbeatTime:2023-11-03 22:57:18 +0800 CST,LastTransitionTime:2023-04-21 14:39:17 +0800 CST,Reason:KubeletReady,Message:kubelet is posting ready status,}
W1103 23:00:41.408493 1 reflector.go:441] k8s.io/client-go/informers/factory.go:134: watch of *v1.Lease ended with: an error on the server ("unable to decode an event from the watch stream: http2: client connection lost") has prevented the request from succeeding
What did you expect to happen?
When the http2 connection lost, the watch should stop as soon as possible. The reflector should relist resource, and node-lifecycle-controller should not mark all node NotReady.
HTTP2_PING_TIMEOUT_SECONDS+HTTP2_READ_IDLE_TIMEOUT_SECONDS should be less than 40s.
How can we reproduce it (as minimally and precisely as possible)?
- Find the controller-manager node-lifecycle-controller watch client srcIP:srcPort. Drop all tcp package send into srcIP:srcPort.
- Wait for more than 40 seconds, all node will be marked NotReady
- All node will be Ready after some seconds.
Anything else we need to know?
No response
Kubernetes version
$ kubectl version
# Server Version: version.Info{Major:"1", Minor:"28+", GitVersion:"v1.28.3", GitCommit:"", GitTreeState:"clean", BuildDate:"2023-10-19T07:10:40Z", GoVersion:"go1.20.10", Compiler:"gc", Platform:"linux/amd64"}
Cloud provider
OS version
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# 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: closed
- Created 3 years ago
- Reactions: 3
- Comments: 18 (14 by maintainers)
I’ll add another data point from our testing. Namely, the simulated recreate noted here depends on the Kubernetes controller manager (KCM) leader election configuration. Using the following leader election configuration for the KCM yields a KCM that has no leader after the delayed etcd defrag. As a result, nodes won’t be marked not ready unless the KCM leadership is restored before the nodes renew their lease.
Extending the KCM leader election configuration to the following, makes the problem easier to recreate.
I have been following this discussion as we had encountered the bug as well. @aojea @rtheis I have created a PR - https://github.com/kubernetes/kubernetes/pull/126287 Please let me know if it works
@aojea I think we should update
node-monitor-grace-period.Hi folks, we have a simulated recreate of the problem. This recreate involves injecting a 40 second delay in “connectivity” between the Kubernetes API server and etcd (we added a 40 second delay to etcd defrag and defragged all etcd members at the same time). The connectivity between these two components is obviously critical to nodes successfully updating their leases in order to stay ready. We use 40 seconds because it matches Kubernetes etcd keepalive configuration. The test will usually cause one or more of the cluster nodes will flap their readiness state. Setting
--node-monitor-grace-period=50son the Kubernetes controller manager prevents the flap. Given this, I think that one or more of the Kubernetes default configurations needs to change in order to tolerate such “connectivity” problems in order to maintain healthy node state.