+++ This bug was initially created as a clone of Bug #1880337 +++
A recent fix in the reflector/informer https://github.com/kubernetes/kubernetes/pull/92688 prevents components/operators from entering a hotloop and stuck.
There are already reported cases that have run into that issue and were stuck for hours or even days. For example https://bugzilla.redhat.com/show_bug.cgi?id=1877346.
The root cause of the issue is the fact that a watch cache is initialized from the global revision (etcd) and might stay on it for an undefined period (if no changes were (add, modify) made).
That means that the watch cache across server instances may be out of sync.
That might lead to a situation in which a client gets a resource version from a server that has observed a newer rv, disconnect (due to a network error) from it, and reconnect to a server that is behind, resulting in “Too large resource version“ errors.
More details in https://github.com/kubernetes/kubernetes/issues/91073 and https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/1904-efficient-watch-resumption
It looks like the issue only affects 1.18. According to https://github.com/kubernetes/kubernetes/issues/91073#issuecomment-652251669 the issue was first introduced in that version by changes done to the reflector.
The fix is already present in 1.19.
Please make sure that cluster-monitoring-operator is using a client-go that includes https://github.com/kubernetes/kubernetes/pull/92688 if not please use this BZ and file a PR.
In case you are using a framework to build your operator make sure it uses the right version of the client-go library.
--- Additional comment from Simon Pasquier on 2020-09-21 10:46:22 UTC ---
cluster-monitoring-operator 4.5 depends on k8s.io/client-go v0.17.1  so it isn't affected by this issue. The same goes for prometheus-operator .
That being said, the 4.6 branches use k8s.io/client-go v0.18.3 and v0.18.2  and they probably need to be fixed.
@Lukasz Should we open another BZ?
--- Additional comment from Lukasz Szaszkiewicz on 2020-09-21 12:20:10 UTC ---
(In reply to Simon Pasquier from comment #1)
> cluster-monitoring-operator 4.5 depends on k8s.io/client-go v0.17.1  so
> it isn't affected by this issue. The same goes for prometheus-operator .
> That being said, the 4.6 branches use k8s.io/client-go v0.18.3 and v0.18.2
>  and they probably need to be fixed.
> @Lukasz Should we open another BZ?
The Kube API in 4.5 is affected. It can return an error that the operators must understand and recover from. Basically anything that uses an informer.
For 4.5/4.6 you should bump at least to 1.18.6 (which has the fix)
--- Additional comment from Simon Pasquier on 2020-09-21 12:30:42 UTC ---
Targeting this bug against 4.6.0. I'll create a clone for 4.5.z.
I am increasing priority to urgent as it already blocks 2 other BZ (1 urgent, 1 low):
tested with 4.5.0-0.nightly-2020-10-15-005105, disconnected the node where cluster-monitoring-operator pod is deployed from network for a few minutes, after reconnection, no "Too large resource version" error for cluster-monitoring-operator container
1. ssh to the node where cluster-monitoring-operator is deployed and execute the the script in the background, it disconnects the node from the network for 5 minutes and reconnect later
$ ./test.sh &
$ cat test.sh
sudo ifconfig ens3 down
sudo ifconfig ens3 up
2. check cluster-monitoring-operator logs after the node is reconnected , there should not have "Too large resource version" error
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (OpenShift Container Platform 4.5.16 bug fix update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.