Kubecost provides the ability to allocate out of clusters costs, e.g. Cloud SQL instances and Cloud Storage buckets, back to Kubernetes concepts like namespace and deployment. All data remains on your cluster when using this functionality and is not shared externally.
The following guide provides the steps required for allocating out of cluster costs.
Step 1: Enable billing data export
Step 2: Visit Kubecost setup page and provide configuration info
In Kubecost, visit the Cost Allocation page and select “Add Key”.
On this page, you will see instructions for providing a service key, project ID, and the BigQuery dataset that you have chosen to export data to.
Step 3: Label cloud assets
You can now label assets with the following schema to allocate costs back to their appropriate Kubernetes owner. Learn more here on updating GCP asset labels.
Cluster: "kubernetes_cluster" : <clusterID> Namespace: "kubernetes_namespace" : <namespace> Deployment: "kubernetes_deployment": <deployment> Label: "kubernetes_label_NAME": <label> Pod: "kubernetes_pod": <pod> Daemonset: "kubernetes_daemonset": <daemonset> Container: "kubernetes_container": <container>
To use an alternative or existing label schema for GCP cloud assets, you may supply these in your values.yaml under the “kubecostProductConfigs.labelMappingConfigs.<aggregation>_external_label”