I have a GCP Persistent Disk associated with a pod in a GKE cluster. How do I find the disk usage for the persistent disk ? Is there any GCP commands which will be help me find the disk usage ?
Thanks a lot for your answers.
I have a GCP Persistent Disk associated with a pod in a GKE cluster. How do I find the disk usage for the persistent disk ? Is there any GCP commands which will be help me find the disk usage ?
Thanks a lot for your answers.
On
You cannot see the disk usage via a prepared command. But, you can check it via Stackdriver Monitoring (Google Cloud Operations Suite) with the metric named container/disk/bytes_used: documentation. You can use Monitoring APIs if you need to automatize it.
Please notice that you must enable Stackdriver on your cluster before. If you haven't, follow the documentation.
TL;DR
You can use the utilization (percentage of used space) of a certain volume mount for a
Podwith following metric:kubernetes.io/pod/volume/utilizationThe description states:
You can use this metric to monitor specific volume mounts that are backed by
Persistent Disk.Using the
kubernetes.io/pod/volume/utilizationmetricAssuming that you have a
GKEcluster with:PVC's that are backed byPD's with100GBof space eachPodswhere each of them is using singlePVCubuntu-ten- where there is 10GB stored on mountedPVCubuntu-twenty- where there is 20GB stored on mountedPVCubuntu-thirty- where there is 30GB stored on mountedPVCYou can follow:
GCP Cloud Console(Web UI) ->Monitoring->Metrics explorerQuerying the API
As asked in the comments under another answer:
Yes they are. You can query the monitoring API for data by using
MQL(Monitoring Query Language).You will need to have query from example used earlier (
volume_utilization). You can extract such query by going intoQuery Editor(it's on last image).To query the API you can use
Try this APIfeature available inGCPdocumentation:Query created with the help of this tool:
In the response you should get the information about the utilization of volumes used by
Pods.Additional resources: