kubeclient: watching stops without any notification
Already saw multiple times that the watcher just stops … without crashing / notifying … Idk how to reproduce that, but it happens regularly … and it does not happen for kube-proxy so either there is a bug in this library or kube-proxy go-lang code has some smart disconnect handling
atm using below and calling .restart every x minutes
class KubernetesWatcher
def initialize(kuber_client, namespace)
@kuber_client = kuber_client
@namespace = namespace
end
def watch(&block)
loop do
@watcher = @kuber_client.watch_endpoints(namespace: @namespace)
@watcher.each(&block)
end
end
def restart
@watcher.finish
end
end
idk how to fix/debug this further but wanted to raise awareness.
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 22 (7 by maintainers)
Commits related to this issue
- document that watcher stops see #273 — committed to grosser/kubeclient by grosser 7 years ago
- document that watcher stops see #273 and add each_with_retry — committed to grosser/kubeclient by grosser 7 years ago
- document that watcher stops see #273 and add each_with_retry — committed to grosser/kubeclient by grosser 7 years ago
- document that watcher stops see #273 and add each_with_retry — committed to grosser/kubeclient by grosser 7 years ago
- document that watcher stops see #273 and add each_with_retry — committed to grosser/kubeclient by grosser 7 years ago
- document that watcher stops see #273 and add each_with_retry — committed to grosser/kubeclient by grosser 7 years ago
confirmed that the block just stops … so having a reconnect by default or optional would be nice … atm I’m just doing
loop do ... watch ... endHey, So I just wanted to add my latest finding here, following a k8s upgrade.
The logs are below, but long story short, the latest resource is
44924022, however if you use that as your starting point, k8s returns 410 GONE (because these particularly resources haven’t been updated in quite some time).The only way to get a watcher started then is to use 0, which returns you ALL the objects.
You’ll then need to filter the returned objects to be >= 44924022.
It’s quite shit really, as you’re potentially returning a lot of objects from the k8s api, especially when the connection times out so frequently (seemingly every 90seconds or so for CRDs in particular)