我一直在尝试使用 python kubernetes API 来流式传输 kubernetes 日志的输出。我计划检索日志并最终使用 Web Socket 来传输日志。from kubernetes import watch...def getLog(pod,namespace): w = watch.Watch() return w.stream(v1.read_namespaced_pod_log, name=pod, namespace=namespace)main(): result = getLog(pod, namespace) for line in result: print(line)但是我收到以下错误。Traceback (most recent call last): File "./kubernetes-project", line 176, in <module> main() File "...venv/lib/python3.6/site-packages/kubernetes/watch/watch.py", line 143, in stream yield self.unmarshal_event(line, return_type) File "...venv/lib/python3.6/site-packages/kubernetes/watch/watch.py", line 91, in unmarshal_event js['raw_object'] = js['object']TypeError: 'int' object is not subscriptable预期输出应低于。然而,日志一直在流式传输,直到128,。3是下一行的预期输出。..."random_crop_size": [ 384, 128, **streaming stops here and error starts showing below** 3...我怀疑该错误可能是由于仅3将行转换为int对象而不是字符串,因此watch无法处理它。知道如何解决这个问题吗?
添加回答
举报
0/150
提交
取消