Describes Kubernetes cluster costs in a time range based on resource allocation.
The response will provide the distribution of the costs per cluster, namespace, and deployment.
For each entity, the response will contain breakdown to compute and EBS costs as well.
In addition, response will show labels/annotations for each namespace or deployment so you can filter costs by labels or annotations.
URL Parameters
Parameter | Type | Description |
---|---|---|
toDate * | String | data values following either a date format (yyyy-mm-dd ; 2016-11-20) or Unix Timestamp (1494751821472) |
fromDate * | String | data values following either a date format (yyyy-mm-dd ; 2016-11-20) or Unix Timestamp (1494751821472) |
aggregationPeriod | String | Possible values: "daily", null. For daily value response contains aggregated data by day. If null - response returns sum of costs per period |
ACCOUNT_ID * | String | Your Spotinst accountId associated with your token Example: act-123abc |
Request
Headers
{ "Content-Type": "application/json", "Authorization": "Bearer ${token}" }
Response - 200
Headers
{ "Content-Type": "application/json" }
Body
{ "request": { "id": "98b7dc69-4bf8-4bec-b508-9377ecb62b46", "url": "/mcs/kubernetes/cluster/clust_1/costs?fromDate=1566492332&toDate=1569426717000", "method": "GET", "timestamp": "2019-09-25T15:55:22.061Z" }, "response": { "status": { "code": 200, "message": "OK" }, "kind": "spotinst:mcs:kubernetes:cluster:costs", "items": [ { "totalCost": 279.9907, "totalComputeCost": 279.9907, "totalEbsCost": 0, "totalStorageCost": 0, "namespaces": [ { "namespace": "default", "cost": 18.00762, "computeCost": 18.00762, "ebsCost": 0, "storageCost": 0, "labels": { "region": "west", "env": "prod" }, "annotations": { "region": "west", "env": "prod" }, "deployments": [ { "name": "cpu-deployment-check5", "namespace": "default", "cost": 3.7410312, "computeCost": 3.7410312, "ebsCost": 0, "storageCost": 0, "labels": { "region": "west", "env": "prod" }, "annotations": { "region": "west", "env": "prod" } } ], "statefulSets": [ { "name": "stateful-example", "namespace": "default", "cost": 3.7410312, "computeCost": 3.7410312, "ebsCost": 0, "storageCost": 0, "labels": { "region": "west", "env": "prod" }, "annotations": { "region": "west", "env": "prod" } } ], "daemonSets": [ { "name": "cpu-deployment-check5", "namespace": "default", "cost": 3.7410312, "computeCost": 3.7410312, "ebsCost": 0, "storageCost": 0, "labels": { "region": "west", "env": "prod" }, "annotations": { "region": "west", "env": "prod" } } ], "jobs": [ { "name": "cpu-deployment-check5", "namespace": "default", "cost": 3.7410312, "computeCost": 3.7410312, "ebsCost": 0, "storageCost": 0, "labels": { "region": "west", "env": "prod" }, "annotations": { "region": "west", "env": "prod" } } ], "standAlonePodsCost": null } ], "deployments": [ { "name": "cpu-deployment-check5", "namespace": "default", "cost": 3.7410312, "computeCost": 3.7410312, "ebsCost": 0, "storageCost": 0, "labels": { "region": "west", "env": "prod" }, "annotations": { "region": "west", "env": "prod" } } ], "headroomCost": 0, "idleCost": 216.10321 } ], "count": 1 } }