kube-watch icon indicating copy to clipboard operation
kube-watch copied to clipboard

Timeout issues?

Open gshiva opened this issue 8 years ago • 3 comments

If I keep running the watcher for a long time (approx an hour or so), I stop getting events. Anyway to keep the watch on continuously?

`

import KubeWatch from 'kube-watch';

const pods = new KubeWatch('pods', {
  url: 'http://localhost:8080'   // Kubernetes API URL
});

pods
  .on('added', event => {
    console.log('Pod %s added to namespace %s with IP address %s with reason %s and message %s',
      event.metadata.name, event.metadata.namespace, event.status.podIP, event.reason, event.message);
  })
  .on('modified', event => {
    console.log('Pod %s modified in namespace %s with IP address %s with reason %s and message %s',
      event.metadata.name, event.metadata.namespace, event.status.podIP, event.reason, event.message);
  })
  .on('deleted', event => {
    console.log('Pod %s deleted in namespace %s with IP address %s with reason %s and message %s',
      event.metadata.name, event.metadata.namespace, event.status.podIP, event.reason, event.message);
  })
  .on('error', err => {
    console.error('Error %d: %s', err.code, err.message);
    console.log('Pod %s errored out in namespace %s with IP address %s with reason %s and message %s',
      event.metadata.name, event.metadata.namespace, event.status.podIP, event.reason, event.message);
  });

`

gshiva avatar Nov 01 '16 17:11 gshiva

Hi gshiva, Did you try to set timeoutSeconds query string parameter (which is part of the k8s list/watch API) ? See query-parameters

subk avatar Nov 02 '16 08:11 subk

@gshiva did you have any luck with this?

SamFleming avatar Jun 01 '17 10:06 SamFleming

@SamFleming - will try it out and let you know. Got distracted with other things

gshiva avatar Sep 08 '17 18:09 gshiva