ops0ops0

Cost Analysis

ops0 integrates with OpenCost to provide real-time cost visibility for your Kubernetes clusters. You can see cost breakdowns by namespace, pod, and controller, track resource efficiency, and link costs back to IaC projects.


Overview

The Kubernetes Cost Analysis feature answers questions like: how much does each namespace cost per month? Which pods are over-provisioned? How efficient is our CPU and memory usage? Where should we right-size?

Namespace Costs

Monthly cost breakdown by namespace

Resource Efficiency

CPU and memory utilization tracking

IaC Linking

Connect costs to infrastructure projects


Cost Report

The cost report is available from the cluster detail page. Click Cost Report to open the analysis modal.

Allocation View

The allocation view breaks down costs by namespace, pod, or controller.

MetricDescription
CPU CostCompute cost based on CPU allocation
Memory CostCost based on memory allocation
GPU CostGPU resource costs (if applicable)
PV CostPersistent volume storage costs
Network CostNetwork transfer costs
Total CostSum of all cost components

Efficiency Metrics

MetricDescription
CPU EfficiencyRatio of CPU used vs. CPU requested
Memory EfficiencyRatio of memory used vs. memory requested
Provisioned CPUTotal CPU allocated to the namespace/pod
Used CPUActual CPU consumed
Provisioned MemoryTotal memory allocated
Used MemoryActual memory consumed

Time Windows

You can analyze costs over different time periods:

WindowDescription
24hLast 24 hours
7dLast 7 days
30dLast 30 days
CustomCustom date range

Aggregation Levels

LevelDescription
NamespaceCost per Kubernetes namespace
PodCost per individual pod
ControllerCost per deployment/statefulset/daemonset

IaC Project Linking

ops0 can detect which IaC project provisioned a Kubernetes cluster and link cost data back to the project. This gives you end-to-end visibility from infrastructure code to running costs.

ConfidenceDescription
HighDirect match between cluster and IaC project resource
MediumProbable match based on naming conventions
LowPossible match, manual verification recommended

Asset View

The asset view shows node-level cost data:

FieldDescription
Node NameKubernetes node identifier
Instance TypeCloud provider machine type
CPU CostNode compute cost
Memory CostNode memory cost
Total CostCombined node cost

GCP Pricing

For GCP clusters, ops0 uses the GCP Pricing API for accurate cost data. Configure your GCP_PRICING_API_KEY in the environment to enable this.

OpenCost Required

Cost analysis requires OpenCost to be installed in your cluster. ops0 can install OpenCost for you from the cluster management page, or you can install it manually using Helm.


Troubleshooting

No Cost Data
Verify that OpenCost is running in the cluster. Check that the opencost pod is healthy and the API is responding.
Inaccurate Costs
Cost data depends on cloud provider pricing APIs. For GCP, ensure the pricing API key is configured. Allow 24-48 hours for cost data to stabilize after initial setup.
Missing Namespaces
OpenCost needs time to collect metrics. New namespaces may take up to an hour to appear in cost reports.