简体   繁体   中英

Is there a way to get number of active Kubernetes Pods in Java

We are building a rate limiter and calculate config values based on number of pods available at that moment. Is there any way to get the number of pods that are active in any instance from a java application? Also, is it possible to get the number of tasks in the case of AWS Fargate from a Java application?

You need to request this info from the Kubernetes API Server. You can do it with Java with kubernetes-client/java . See InClusterClientExample

You are interested in the pods in Ready state matching a specific label that is representing (matching) your "application".

If you are only interesting in the number of Ready pods for a specific application, you can also request the Deployment directly instead of pods be a label.

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