My objective is to get the maximum allowed disk IOPS and Egress bandwidth details of my nodes and disks running in GKE through an API call or similar procedure. I am using compute_v1.DisksClient to get details of node disks of my cluster. The output given here has a field of provisioned IOPS. I am running the code below:
from google.cloud import compute_v1
PROJECT_ID = "my-project-id"
x=compute_v1.DisksClient()
ZONE="us-central1-c"
request=compute_v1.ListDisksRequest(project=PROJECT_ID, zone="us-central1-c")
print(x.list(request))
The output does not include any such field; in fact, many fields are missing. Can one please tell the mistake, or/and give a method to extracting max disk IOPS and egress bandwidth?
The compute_v1.DisksClient API call will not return a disk's maximum allowed IOPS or egress bandwidth. These details are tied to the type of persistent disk (standard vs SSD) and the size of the disk, and are not exposed via API.
Here are helpful information about IOPS:
Unfortunately there is no API to directly fetch the maximum allowed disk IOPS or Egress bandwidth. However, you can configure your disks to meet your performance requirements by issuing enough I/O requests in parallel[2]. Also, here are some documentations that can support your use case.[3][4]
Lastly, the egress bandwidth is not directly linked to the disk but is more of an instance-level or network-level concept, also not exposed via APIs.[5]
I hope this helps!
[1] https://cloud.google.com/compute/docs/disks/performance#pd-performance
[2] https://cloud.google.com/compute/docs/disks/performance.
[3] https://cloud.google.com/compute/docs/disks/
[4] https://cloud.google.com/storage/docs/apis
[5] https://cloud.google.com/vpc/docs/vpc#egress_throughput_caps