Links

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.

Audit API

The Audit API verifies cached data sources of Kubecost for the validity of the data sources and processes through a series of tests.

Optimization APIs

Savings API

Savings endpoints provide cost optimization insights. The following savings endpoints are available at http://<kubecost-address>/model/ENDPOINT:
Endpoint
Brief description
/savings
Provides cluster-level potential savings estimates based on specific savings opportunities available in other endpoints.
Provides recommendations for setting container resource requests.
/projectDisks
List orphaned disks.
/projectAddresses
List orphaned IP addresses.
List abandoned workloads based on network traffic.
/savings/clusterSizing
Provides recommendations for sizing clusters (node types and quantities).
Applies Kubecost's container request recommendations to your cluster.

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
Savings dashboard