'gcp billing bigquery : nodepool level billing
I'm trying to get GCP billing costs on a GKE nodepool level .
I understand that the GKE usage metering feature only takes the labels of pods and PVCs into its table therefore giving workload level visibility into billing.
I also looked into the Standard usage cost data table which generates a table like gcp_billing_export_v1_<BILLING_ACCOUNT_ID> . This table also only generates labels for instance nodes of the google compute engine and even in the GKE side of things it only generates labels for clusters.
I tried to see if I could leverage the labels of instance templates but that would require me to manually add labels to all our instance templates of google compute engine which were created by GKE.
I'd like to know if there's a way where while creating a nodepool we can add labels that somehow would show up in either of the two bigquery tables above or if they can somehow be propagated to the VM instance templates created for the nodepool by GKE.
Solution 1:[1]
With GKE Usage metering, you can get cost based on namespace, label, deployment - https://www.economize.cloud/blog/gke-usage-cost-monitoring-kubernetes-clusters/
If you want to get cost based on nodes, you will need to add labels when you create the nodepools. Unfortunately, I think adding labels to existing nodepools would not be possible. These labels should propogate to the Standard Usage cost dataset.
Solution 2:[2]
You could try this:
@controllers.route('/delete-notes/', methods=['GET'])
def delete_notes():
num_activities_deleted = db.session.query(UserActivity).delete()
db.session.commit()
return jsonify({"num_activities_deleted ": num_activieties_deleted })
and js:
const deleteNotes = id => fetch(`/delete-notes/`,{
method: 'GET'
}).then((_res) =>{
$(`#act-`).remove();
alert("deleted: " + num_activities_deleted + " activities" )
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Anirudh M |
| Solution 2 |
