Container Rightsizing

Summary

The Container Rightsizing API endpoint provides rightsizing recommendations for rightsizing Kubernetes container specification across services currently reporting into the Cloudability Container Cost Allocation Pipeline. For each of these resources, the API returns multiple optimization recommendations as well as descriptive information such as the namespace, workload relevant pod count, current cost allocation and recommended action(s).

Endpoint

This endpoint is read-only for retrieving a list of container rightsizing recommendations objects.

  • /rightsizing/containers/recommendations/workloads

Endpoint Arguments

Argument

Description

Basis(Required)

The cost basis used.
Values are on-demand or effective
Default = on-demand

Duration(Required)

The look back period in days, used for calculating the recommendations.

Valid values are : ten-day and thirty-day
Default = ten-day

Filters

Filter the resources based on an attribute of your choice.
Example: filters=recommendations.action==Rightsize. To base on attribute within recommendation itself prefix with 'recommendations.'. Multiple filters can be chained together with commas. Example: filters=recommendations.savings>20,recommendations.risk==0

Limit(Required)

Used together with offset and sort to determine the quantity of recommendations objects returned per request.
Example: limit=10.
Default = 25

Offset

Used together with limit and sort to provide pagination.
Example: offset=0
default = 0

Product

Product Name,
Example: product=workloads

Sort

Sort the recommendations based on an attribute.
Example:
sort=-recommendations.savings
(sort by savings, descending)

Default:
sort=-recommendations.savings

Example Container Rightsizing Recommendations Request

The following will list the three container rightsizing recommendations with the greatest savings based on a 10-day look-back period and on-demand pricing.

curl "https://api.cloudability.com/v3/rightsizing/containers/recommendations/workloads?basis=on-demand&duration=ten-day&filters=recommendations.rank%3D%3D1&limit=3&maxRecsPerResource=1&offset=0&product=workloads&sort=-recommendations.savings&vendorAccountIds=" \ 
     -u '[auth_token]:'

Example Container Rightsizing Response Object

{
  "result": [
    {
      "service": "containers-workloads-recs",
      "resourceIdentifier": "production-operations:cluster:app-hourly-summarizer:production-hourly-summarizer",
      "vendorAccountId": "############",
      "provider": "NATIVE",
      "currencyCode": "USD",
      "clusterName": "production-operations",
      "namespace": "abcd",
      "workloadName": "workload-abcd-efgh-ijklm",
      "containerName": "container-hourly-summarizer",
      "workloadType": "Deployment",
      "podCount": 15,
      "cpuRequest": 1000,
      "cpuLimit": 2000,
      "memoryRequest": 15360,
      "memoryLimit": 30720,
      "request": "1000m 15360Mi",
      "limit": "2000m 30720Mi",
      "idle": 0,
      "totalSpend": 428.43,
      "lastSeen": "2021-05-18T00:00:00Z",
      "labels": [
        {
          "name": "app",
          "value": "app-hourly-summarizer"
        },
        {
          "name": "environment",
          "value": "production"
        },
        {
          "name": "team",
          "value": "containers"
        }
      ],
      "recommendations": [
        {
          "action": "Rightsize",
          "cpuRequest": 1000,
          "cpuLimit": 1251,
          "memoryRequest": 4167,
          "memoryLimit": 4792,
          "request": "1000m 4167Mi",
          "limit": "1251m 4792Mi",
          "preferenceOrder": 1,
          "savingsPct": 69,
          "savings": 295.95,
          "risk": 1
        }
      ]
    },