Architecture Available in v1.20.0+
Overview
ScaleOps integrates with Google Cloud Billing to provide accurate compute costs by reconciling current Kubernetes spend with your actual Google Cloud bill.
This is done by accessing a BigQuery dataset that contains detailed usage cost exports (configured manually through the Google Cloud Console). The dataset contains the actual cost of each virtual machine, after applying the various discounts - such as Committed Use Discounts (CUDs), Sustained Use Discounts, and Spot instances.
ScaleOps periodically queries the BigQuery dataset and updates the current hourly prices of individual nodes accordingly. These prices propagate to the rest of the system, including ‘live’ cost, historical cost reports, etc.
Refer to Google Cloud documentation for further information about BigQuery billing data export.
Diagram
ScaleOps Managed Service Account
When running the integration script, ScaleOps will create a service account in your Google Cloud project and will assign the necessary BigQuery permissions to access your billing data.

Self-Managed Service Account
When running the integration script, ScaleOps will create a service account in your Google Cloud project and will output the required credentials. You will need pass these credentials to the ScaleOps platform.
See advanced setup for more details.

Calculation of Discounted Prices Based on Google Cloud Billing Data
The daily cost is calculated by averaging the cost per unit per machine from the detailed usage cost data.
daily_cost = avg(sum(cost) / sum(usage.amount))The pricing model is determined by the predominant discount type applied over the billing period. For example: If a node ran with Committed Use Discounts for most hours and on-demand pricing for fewer hours, the pricing model will be CUD.
Applying Discounted Prices from Google Cloud to Cluster Nodes
GKE cluster nodes are matched with respective Google Cloud virtual machines in the billing export by:
- Google Cloud project ID where the cluster is hosted
- Instance ID and zone information
- Instance metadata including machine type and region
- Resource labels and tags from the billing data
BigQuery Job Execution
The ScaleOps agent runs a BigQuery job every 3 days, covering the previous 3 days. The query uses time partitioning, so only the last 3 days are scanned by default.
You can configure the number of days to scan using the days helm value to get more accurate cost results, though this will increase the amount of data scanned in BigQuery.
If the virtual machine does not appear in the export, ScaleOps attempts to infer the price from prices of other similar VMs - e.g., those with same machine type, zone, and operating system (since the discounts typically apply to machine types rather than specific instances).
Known Limitations
- Manual billing export setup is required - Google Cloud does not provide an API to automatically configure billing exports to BigQuery.
- Currently, ScaleOps does not update discounted prices retroactively - meaning that historical prices prior to enablement of the Google Cloud cost integration might not be accurate.
- Billing data is processed at the project level, meaning billing export data needs to be accessible for each project containing GKE clusters.
- There may be a delay of up to 24-48 hours for billing data to appear in BigQuery after resource usage.