简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM