How to get allocated gpus for node in kubernetes[with kubernetes-client java api]

7/27/2019

I want to get available gpus[nvidia.com/gpu] in kubernetes cluster, and i now get total gpu from NodeAPI, but how to get allocated gpus from client api?? like kubectl describe node result:

Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource           Requests   Limits
  --------           --------   ------
  cpu                350m (8%)  0 (0%)
  memory             70Mi (0%)  170Mi (1%)
  ephemeral-storage  0 (0%)     0 (0%)
  nvidia.com/gpu     1          1
-- jefby
kubernetes

0 Answers