title: Kubernetes: How do I get the status and restarts of a container using python?
body: <p>I would like to get the container status and restarts of a pod, using <a href="https://github.com/kubernetes-client/python" rel="nofollow noreferrer">python kubernetes</a>. I am currently using <a href="https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/CoreV1Api.md#list_namespaced_pod" rel="nofollow noreferrer">list_namespaced_pod</a> to get the pods and the <a href="https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1ContainerStatus.md" rel="nofollow noreferrer">container status</a>, which I interpret as the status of the pod. This works, but is far from an ideal solution. I am looking for something that gives me similar information to <code>kubectl -n $NAMESPACE get pods</code>.</p>