Kubecost API Directory

Welcome to the Kubecost API library! This directory will show you how Kubecost APIs can assist in monitoring, maintaining, and optimizing your cloud spend. Learn also how Kubecost APIs power different features of the UI below.

Throughout our API documentation, you may see two separate endpoints for the same API, with one labeled 'Aggrgegator-only', or a subsection in an article for Aggregator-only parameters. Those endpoints or parameters are only for users who have configured Kubecost Aggregator. If you do not have Aggregator configured in your environment, do not use those Aggregator endpoints or parameters.

Monitoring APIs

The Allocation API retrieves cost allocation information for any Kubernetes concept, e.g. cost by namespace, label, deployment, service, and more. This API is directly integrated with the Kubecost ETL caching layer and CSV pipeline so it can scale for large clusters.

The Allocation Trends API compares cost usage between two windows of the same duration and presents a percentage value showing the change in cost.

The Assets API retrieves the backing cost data broken down by individual Kubernetes assets (e.g. node, disk, etc.), and provides various aggregations of this data. Optionally provides the ability to integrate with external cloud assets.

The Asset Diff API compares two asset sets between two windows of the same duration and accumulates the results.

The Cloud Costs API retrieves cloud cost data from cloud providers by reading cost and usage reports.

The Cloud Cost Trends API compares cost usage between two windows of the same duration and presents a percentage value showing the change in cloud costs.

Governance APIs

The Budget API allows you to establish spending budget rules for your workload across clusters and namespaces to ensure you don't go over your allotted budget.

The Cost Events Audit API presents recent changes at the cluster level.

The Prediction API takes Kubernetes objects as input and produces an estimation of the cost impact when making changes to your workload.

Diagnostic APIs

The Events API provides a log of different occurrences in your workload in order to help with troubleshooting. Logs generated with this API are helpful for submitting bug reports.

Optimization APIs

Savings API

Savings endpoints provide cost optimization insights. The following savings endpoints are available at http://<kubecost-address>/model/ENDPOINT:

EndpointBrief description

/savings

Provides cluster-level potential savings estimates based on specific savings opportunities available in other endpoints.

Provides recommendations for sizing clusters (node types and quantities).

Provides recommendations for setting container resource requests.

List abandoned workloads based on network traffic.

Applies Kubecost's container request recommendations to your cluster.

/projectDisks

List orphaned disks.

/projectAddresses

List orphaned IP addresses.

Kubecost UI counterparts

Many, but not all, Kubecost APIs power different features in the Kubecost UI. The UI counterpart may not fully reflect all functionality of the corresponding API. Please consult the original API docs for complete details.

API NameUI Equivalent

Allocation API

Allocation/Cloud Cost Explorer Trends API

Allocations/Cloud Cost Explorer dashboards, Total cost column percentage

Assets API

Cloud Cost API

Budget API

Cost Events Audit API

Predict API

Savings API

Cluster Right Sizing Recommendation API

Container Request Right Sizing Recommendation API

Abandoned Workloads API

Last updated