<p>I have a Kubernetes cluster, in which different pods are running in different namespaces. How do I know if any pod failed?</p>
<p>Is there any single command to check the failed pod list or restated pod list?</p>
<p>And reason for the restart(logs)?</p>

<p>Depends if you want to have detailed information or you just want to check a few last failed pods.</p>
<p>I would recommend you to read about <a href="https://kubernetes.io/docs/concepts/cluster-administration/logging/" rel="nofollow noreferrer">Logging Architecture</a>.</p>
<p>In case you would like to have this detailed information you should use 3rd party software, as its described in Kubernetes Documentation - <a href="https://kubernetes.io/docs/tasks/debug-application-cluster/logging-elasticsearch-kibana/" rel="nofollow noreferrer">Logging Using Elasticsearch and Kibana</a> or another one <a href="https://www.fluentd.org/" rel="nofollow noreferrer">FluentD</a>.</p>
<p>If you are using Cloud environment you can use Integrated with <code>Cloud Logging</code> tools (i.e. in <code>Google Cloud Platform</code> you can use <code>Stackdriver</code>).</p>
<p>In case you want to check logs to find reason why pod failed, it's good described in K8s docs <a href="https://kubernetes.io/docs/tasks/debug-application-cluster/debug-running-pod/" rel="nofollow noreferrer">Debug Running Pods</a>.</p>
<blockquote>
<p>If you want to get logs from specific pod</p>
</blockquote>
<pre><code>$ kubectl logs ${POD_NAME} -n {NAMESPACE}
</code></pre>
<blockquote>
<p>First, look at the logs of the affected container:</p>
</blockquote>
<pre><code>$ kubectl logs ${POD_NAME} ${CONTAINER_NAME} 
</code></pre>
<blockquote>
<p>If your container has previously crashed, you can access the previous container's crash log with:</p>
</blockquote>
<pre><code>$ kubectl logs --previous ${POD_NAME} ${CONTAINER_NAME}
</code></pre>
<p>Additional information you can obtain using</p>
<pre><code>$ kubectl get events -o wide --all-namespaces | grep &lt;your condition&gt;
</code></pre>
<p>Similar question was posted in <a href="https://stackoverflow.com/questions/56673619/display-failed-pods-from-kubectl-output">this SO thread</a>, you can check if for more details.</p>
