-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Description
I noticed that if I'm following a pod log that is being actively written to it will timeout after 5 minutes. However if the pod is not writing logs the request will not timeout. In that case the request will remain open seemingly indefinitely.
I can change the behavior by modifying this line of code:
https://github.com/GoogleCloudPlatform/kubernetes/blob/master/pkg/kubelet/server.go#L68
To make it happen faster you can set the value lower. I've been testing with 1 minute.
Steps to reproduce:
- Launch cluster
- Create the nginx pod in
examples/pod.yaml
- In another terminal generate log output by hitting the pod:
while :; do curl 172.17.0.22; sleep 0.5; done
(you'll need to change the ip). - Watch the logs:
time curl -ivs --raw "http://127.0.0.1:8080/api/v1beta3/namespaces/default/pods/nginx/log?container=nginx&follow=true&previous=false"
In this case whenever the WriteTimeout is reached curl will receive the zero sized chunk and the connection will be closed. If you leave out step 3 curl will continue seemingly indefinitely.
This behavior definitely seems odd. Is the usage of WriteTimeout correct here? A quick search shows that others have been confused by the intention of WriteTimeout which is why I ask.