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.

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 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. Unlike the Allocation and Asset APIs, it must be manually enabled.

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:
Brief description
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.
List orphaned disks.
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 Name
UI Equivalent
Allocation API
Allocation Trends API
Allocations dashboard, 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