What Kubernetes API endpoint can I use to see if there are unscheduled pods?


I am trying to write a .net core application to run in a kubernetes pod. This application needs to know if the cluster has been unable to schedule any pods.

I have tried getting deployment data from

kubectl get --raw /apis/apps/v1/namespaces/default/deployments

I can see the unavailableReplicas number and the MinimumReplicasUnavailable message.

Are these valid metrics to watch for the cluster status?

Is there a way to query the cluster as a whole instead of by deployment?

-- leemicw

1 Answer


If you are looking for the images in each node in the cluster you can try

kubectl get nodes -o json

which will return a json object or using --field-selector as shown below.

kubectl get pods --all-namespaces --field-selector=status.phase==Pending

and using api

kubectl get --raw /api/v1/pods?fieldSelector=status.phase==Pending
-- Bimal
Source: StackOverflow