private Watch doWatchPod(long updateId, String resourceVersion) {
        final Watcher<Pod> watcher = new Watcher<Pod>() {
            @Override
            public void eventReceived(Action action, Pod resource) {
                if (closed) {
                    return;
                }
                numPodFailures = 0;
                withUpdateLock(updateId, () -> {
                    if (!updatePod(action, resource)) {
                        return;
                    }
                    maybeUpdateEndpoints();
                });
            }

            @Override
            public void onClose(WatcherException cause) {
                if (closed) {
                    return;
                }

                logger.warn("[{}/{}] Pod watcher is closed.", namespace, serviceName, cause);
                scheduleRestartWithBackoff(++numPodFailures);
            }

            @Override
            public void onClose() {
                logger.info("[{}/{}] Pod watcher is closed gracefully.", namespace, serviceName);
            }
        };

        final Service service = this.service;
        assert service != null;
        final Map<String, String> selector = service.getSpec().getSelector();
        // watch() method will block until the watch connection is established.
        if (namespace == null) {
            return client.pods().withLabels(selector).withResourceVersion(resourceVersion).watch(watcher);
        } else {
            return client.pods().inNamespace(namespace).withLabels(selector)
                         .withResourceVersion(resourceVersion).watch(watcher);
        }
    }
Watches the service. {@link Watcher} will retry automatically on failures by {@link KubernetesClient}.
kubernetes/src/main/java/com/linecorp/armeria/client/kubernetes/endpoints/KubernetesEndpointGroup.java