question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing `follow=True` to `read_namespaced_pod_log` makes it never return

See original GitHub issue

I’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:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:22 (15 by maintainers)

github_iconTop GitHub Comments

6reactions
nakulpathak3commented, Oct 31, 2018

Ah so what I did initially was close but the temporary fix that worked for me was -

for line in client.CoreV1Api.read_namespaced_pod_log('<pod_name>', 'default', follow=True, _preload_content=False).stream():
    print(line)
1reaction
Moofasaxcommented, Aug 5, 2019

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found