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.
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
but if the pod status is error state ,the Kubernetes api shows as running. below is my code
var config = KubernetesClientConfiguration.InClusterConfig();//for local testing BuildDefaultConfig && for cluster testing InClusterConfig
var client = new Kubernetes(config);
var namespaces = client.ListPodForAllNamespaces();
foreach (var ns in namespaces.Items){
Console.WriteLine(ns.Metadata.Name +" status - "+ns.Status.Phase);
}
OUTPUT IS
test-web-api-78777-2zlwl status - Running
jobapp1-878787-knt46 status - Running
jobapp2-878787-knt46 status - Running
jobapp? Also provide output ofkubectl describe <pod_name> -n api. In some scenarios pod could gorunnung > CrashLoopBackOffbut in most of the cases its just go straight toCrashLoopBackOffif there is something wrong. It would be good to reproduce this behavior and check if this scenario wasrunning > Crash. - PjoterS