kubernetes: `kubectl get --watch` eventually just exits

Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see http://kubernetes.io/docs/troubleshooting/.): No

What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.): kubectl, watch, get, exit


Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Kubernetes version (use kubectl version): 1.5.3

Environment:

  • Cloud provider or hardware configuration: Google Cloud Platform, GKE
  • OS (e.g. from /etc/os-release): Kubernetes: ChromeOS (GKE image). Client: macOS.
  • Kernel (e.g. uname -a): 4.4.21
  • Install tools:
  • Others:

What happened: kubectl get pods -w will eventually just exit with exit status 0 and no message. No network disruption that I know about. No error messages.

What you expected to happen: I expected kubectl to watch for ever.

How to reproduce it (as minimally and precisely as possible): Run kubectl get pods -w and wait long enough. (I’m running it again now with a timer to see if there’s any concistency here.)

Anything else we need to know: It’s worth pointing out that it also exits if there’s a network blip or I change wifi networks. I think -w should follow the user’s intention and try to keep watching in the face of temporary, recoverable errors.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 22 (12 by maintainers)

Most upvoted comments

Are there any workarounds to keep --watch commands running indefinitely?

while true; do clear && kubectl get hpa --watch && sleep 1; done

/reopen

All watches are terminated by the server after a certain point. No retries are done today.

Above is sufficient answer and I’m not expecting us fixing this. /close

@cmcarey: You can’t reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

Yes, imo this is a bug.
I would expect it to watch until I exit the proc.

/reopen /remove-lifecycle rotten

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.