Passing `follow=True` to `read_namespaced_pod_log` makes it never return
See original GitHub issueI’m trying to stream logs out of a running pod.
For a pod named ‘test’ running in the default namespace,
api = client.CoreV1Api()
api.read_namespaced_pod_log("test", "default")
returns the logs so far. But,
api = client.CoreV1Api()
api.read_namespaced_pod_log("test", "default", follow=True)
just never returns. I can’t use it with watch.Watch
either since that seems to be for a very different purpose.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:22 (15 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah so what I did initially was close but the temporary fix that worked for me was -
Having trouble using this, am i missing something?
v1 = client.CoreV1Api()
w = watch.Watch()
for e in w.stream(v1.read_namespaced_pod_log, name=pod, namespace=namespace, follow=True, tail_lines=1, limit_bytes=560, _preload_content=False): print(e)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.7/site-packages/kubernetes/watch/watch.py", line 132, in stream resp = func(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/kubernetes/client/apis/core_v1_api.py", line 18538, in read_namespaced_pod_log (data) = self.read_namespaced_pod_log_with_http_info(name, namespace, **kwargs) File "/usr/local/lib/python3.7/site-packages/kubernetes/client/apis/core_v1_api.py", line 18576, in read_namespaced_pod_log_with_http_info " to method read_namespaced_pod_log" % key TypeError: Got an unexpected keyword argument 'watch' to method read_namespaced_pod_log
Posted on stackoverflow if anyone wanted to answer!