Used to retrieve the allocatable resources of a Kubernetes cluster.
Assumes that this is being executed within the K8s cluster.
Tested using python 2.7 and requires the installation of two pip libraries:
pip install pint
pip install kubernetes
It provides the same values as kubectl describe nodes
, for example:
Allocated resources:
(Total limits may be over 100 percent, i.e., overcommitted.)
Resource Requests Limits
-------- -------- ------
cpu 660m (34%) 500m (25%)
memory 622Mi (11%) 938Mi (16%)
ephemeral-storage 0 (0%) 0 (0%)
Thank you!!!!!