I have multiple GKE clusters with logically separated K8s objects using namespaces, each namespace has GCS bucket attached to it (Statefulset)
I wanted to know billing information about each namespace and what each namespace costs for resources usage.
I found very useful feature called "GKE Metering" and yea it showed up some useful information about CPU and Memory billing info for each namespace by gathering billing information and import it into BigQuery, then I can visualize the results using Google Data Studio for example.
The Question Is:
For that, you need to add a label on your GCS bucket
Then to export the billing to BigQuery
And to get the data like that in BigQuery
SELECT *
FROM `project.dataset.exportBillingTable`
WHERE "<Your Label Key>" IN UNNEST(labels.key)
You can perform "group by", "sum", filter on the label key or the label value,...
This is now available without the labeling step! The update was released in February 13, 2024
View granular cost data from Cloud Storage usage in Cloud Billing exports to BigQuery
You can now view granular Cloud Storage bucket-level cost data in the Cloud Billing Detailed cost export. Use the
resource.global_namefield in the export to view and filter your detailed Cloud Storage bucket usage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With