Kubecost's extract, transform, load (ETL) process is a computed cache built upon Prometheus metrics and cloud billing data, from which nearly all API requests made by the user and the Kubecost frontend currently rely upon.
The ETL data is stored in a PersistentVolume
mounted to the kubecost-cost-analyzer
pod. In the event that you lose or are looking to rebuild the ETL data, the following endpoints should be used.
Configuring ETL Backups can prevent situations where you would need to repair large amounts of missing ETL data. This is not required in Federated ETL environments.
The Asset ETL builds upon the Prometheus metrics listed here. It's important to ensure that you are able to query for Prometheus or Thanos data for the specified window
you use. Otherwise, an absence of metrics will result in an empty ETL. Learn more about this API in our CloudCost Diagnostic APIs doc.
If the window
parameter is within .Values.kubecostModel.etlHourlyStoreDurationHours
, this endpoint will repair both the daily [1d]
and hourly [1h]
Asset ETL.
The Allocation ETL builds upon all previous Asset data to compute cost and resource allocations for Kubernetes entities. Read our Kubecost Diagnostics doc for more info.
If the window
parameter is within .Values.kubecostModel.etlHourlyStoreDurationHours
, this endpoint will repair both the daily [1d]
and hourly [1h]
Allocation ETL.
The CloudCost ETL pulls information from your cloud billing integration. Ensure it's been configured properly, otherwise, no data will be retrieved. Review our Cloud Billing Integrations doc for more info.
By default, Kubecost v1.106+ no longer has CloudUsage ETL enabled (.Values.kubecostModel.etlCloudUsage
, .Values.kubecostModel.etlCloudAsset
). If you are using CloudUsage ETL, use the commands below:
The Reconciliation Pipeline reconciles the existing ETL with the newly gathered data in the CloudUsage ETL, further ensuring parity between Kubecost and your cloud bill.
Reconciliation repairs should be automatically triggered after a CloudCost repair.
In a Federated ETL environment, each individual Kubecost deployment builds its own ETL data before pushing it to the bucket. Therefore the repair commands above must be run on each affected cluster.
After a repair has been completed on any cluster in your environment, the Kubecost Federator will detect the new data, re-federate the ETL data, then place the merged data into the /federated/combined
directory in the bucket. The Federator runs 5 minutes after startup, and every 30 minutes afterwards.
If the ETL data looks incorrect, or you see one of the following error messages, there are several things to check:
Verify that Prometheus or Thanos metrics exist consistently during the time window you wish to repair
For installs using Prometheus verify retention is long enough to meet the requested repair window. By default .Values.prometheus.server.retention
is set to 15 days.
For multi-cluster deployments verify the Thanos Store --min-time
is long enough to meet the requested repair window. This is set with .Values.thanos.store.extraArgs
.
In v1.104 of Kubecost, you may experience incorrect data display if running the Federated ETL architecture. Specifically you may see that your asset prices are correct but heavily consist of "Adjustments", and that your allocation's idle costs are incorrect. To fix this, perform the following recovery steps:
Identify the data range for your affected data. This will be used later.
Disable reconciliation by setting the Helm flag:
Upgrade to a fixed version of Kubecost. For best results, upgrade to the most recent version.
For both Assets and Allocations, repair the affected dates on the primary cluster. This will only repair data from the primary cluster, not any secondary clusters. If repairing dates beyond your primary cluster's Prometheus retention, there may be data loss for your primary cluster. Refer to the instructions above for /model/etl/asset/repair
and /model/etl/allocation/repair
.
After Asset and Allocation data has been repaired, restart the Federator pod. This will force the Federator to re-federate the data upon 5 minutes of startup. Confirm the procedure has worked by validating some of the following:
Query the last 7 days of data and observe reasonable unadjusted data.
Review the Federator's logs. Example shown above.
Check the following directories in your storage bucket, to see that the files for impacted dates have been recently modified. If your data has not been re-federated, you may need to manually delete the files for impacted dates and perform Step 4 again.
/federated/combined/etl/bingen/allocations/1d
/federated/combined/etl/bingen/assets/1d
Reenable reconciliation by setting the Helm flag: