如果我跑
kubectl -n=mynamespace describe pod mypodname
例如,我得到以下输出:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning Unhealthy 43s (x30458 over 3d17h) kubelet, myhostname Readiness probe failed: HTTP probe failed with statuscode: 404
现在,我如何通过python库https://github.com/kubernetes-client/python获得这个
我可以获取POD信息,例如,对所有名称空间使用list_POD_,并获取一个POD对象https://github.com/kubernetes-client/python/blob/6d64cf67d38337a6fdde1908bdadf047b7118731/kubernetes/docs/V1Pod.md
但是这只会告诉我(在podobject.status.conditions属性中)容器还没有准备好,但是我没有得到像上面404状态码那样的详细信息
有什么想法吗
谢谢大家!
1)首先,您可以在这里找到所有方法:CoreV1Api.md
2)您感兴趣的零件:
3)你的正确方法是
read_namespaced_pod
4)您的代码取自How to get log and describe of pods in kubernetes by python client的@Prafull Ladha
相关问题 更多 >
编程相关推荐