<p>i tried ListPodForAllNamespaces() using Kubernetes API C# library .Using  Status.Phase property to get the current status of the pod.
when i tried to kubectl comman to get the pod status ,it is shows as  crashloop and error state.</p>
<pre><code>kubectl get pods -n api
NAME                                 READY   STATUS             RESTARTS   AGE
test-web-api-78777-2zlwl             1/1     Running            0          9m8s
jobapp1-878787-knt46                 0/1     CrashLoopBackOff   5          4m53s
jobapp2-878787-knt46                 0/1     Error              5          4m53s
</code></pre>
<p>but if the pod status is error state ,the Kubernetes api shows as running.
below is my code</p>
<pre><code>var config = KubernetesClientConfiguration.InClusterConfig();//for local testing BuildDefaultConfig &amp;&amp; for cluster testing InClusterConfig
    var client = new Kubernetes(config);
    var namespaces = client.ListPodForAllNamespaces();
    foreach (var ns in namespaces.Items){
        Console.WriteLine(ns.Metadata.Name +&quot; status - &quot;+ns.Status.Phase);
    }
</code></pre>
<p><strong>OUTPUT IS</strong></p>
<blockquote>
<p>test-web-api-78777-2zlwl  status - Running<br />
jobapp1-878787-knt46 status - Running<br />
jobapp2-878787-knt46 status - Running</p>
</blockquote>

avancho marchos
<p>Neither your <code>kubectl</code> command nor your <code>C#</code> kubernetes api is wrong.</p>
<p>You can see that the last two pods restarted 5 times. Each of them was in <code>Running</code> state for some time during restarting for 5 times.</p>
<p>When you ran your <code>C#</code> api, all of the pods were actually in <code>Running</code> phase.</p>
<p>If you run your <code>C#</code> api after waiting for a bit, you will see that they are not in <code>Running</code> phase.</p>
