fbpx
GEThttps://api.spotinst.io/mcs/kubernetes/cluster/{clusterIdentifier}/costs?fromDate={timeDate}&toDate{timeDate}

Describes Kubernetes cluster costs in a time range based on resource allocation.

The response will provide the costs distribution per cluster, namespace, and deployment

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)

Request

Headers
{
    "Content-Type": "application/json",
    "Authorization": "Bearer ${token}"
}
Response - 200

Headers
{
    "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
    "request": {
        "id": "9768cc69-8c7b-4245-bdb1-18f8097029d0",
        "url": "/mcs/kubernetes/cluster/mycluster/costs?fromDate=2018-06-20&toDate=2018-07-20",
        "method": "GET",
        "timestamp": "2018-07-20T07:48:46.593Z"
    },
    "response": {
        "status": {
            "code": 200,
            "message": "OK"
        },
        "kind": "spotinst:mcs:kubernetes:cluster:costs",
        "items": [
            {
                "totalCost": 115.97803,
                "namespaces": [
                    {
                        "namespace": "prd354",
                        "cost": 64.812904
                    },
                    {
                        "namespace": "prd1811",
                        "cost": 0.912011
                    },
                    {
                        "namespace": "t-system",
                        "cost": 7.864456
                    },
                    {
                        "namespace": "h-contour",
                        "cost": 1.3037746
                    },
                    {
                        "namespace": "prd1683",
                        "cost": 2.154953
                    },
                    {
                        "namespace": "kube-system",
                        "cost": 15.617937
                    },
                    {
                        "namespace": "prd122",
                        "cost": 2.5223486
                    },
                    {
                        "namespace": "prd396",
                        "cost": 0.68626857
                    },
                    {
                        "namespace": "prd121",
                        "cost": 0.9387672
                    },
                    {
                        "namespace": "ko",
                        "cost": 0.934621
                    }
                ],
                "deployments": [],
                "standAlonePodsCost": 0,
                "headroomCost": 18.23413
            }
        ],
        "count": 1
    }
}