Manage costs
Cost monitoring is a feature of Kubernetes Monitoring that enables you to manage the cost of cloud resources that your Kubernetes infrastructure is consuming. In the Cost view, you can examine visualizations that unlock comprehensive insights about spending. These insights enable you to make data-driven decisions about resource allocation, scaling strategies, and technology investments. With cost monitoring, you can immediately begin to:
- Observe costs per resource and infrastructure type.
- Identify savings based on unused CPU, RAM, and storage that stays untouched for a specific period of time.
- Gain insight on the costs of network egress and GPU.
- Compare savings and costs trends.
Kubernetes Monitoring is based on an OpenCost integration and Grafana’s experience in managing Kubernetes-related costs. OpenCost uses information about your cluster to provide metrics that measure infrastructure and container costs in real time.
Use cost monitoring strategically
Here are some strategies you can use to manage the costs of your Kubernetes infrastructure:
- Compare costs. Use the cluster grouping mechanism in Kubernetes Monitoring to compare costs across different cloud providers or Kubernetes distributions to gain insight per cloud provider and per cluster.
- Verify scaling. Assess the cost implications of scaling resources by using Kubernetes autoscaling mechanisms. With horizontal and vertical autoscalers, you can dynamically adjust resource allocation based on demand. Then verify your adjustments are reducing costs by using Kubernetes Monitoring to compare the past and present resource allocation.
- Right-size your clusters, namespaces and Nodes. Use the Efficiency view and dashboard to:
- Reduce number of Nodes where resources are scarcely utilized.
- Work on better Pods and namespace placement to optimize the usage of the resources already available.
- Discover and optimize resource intensive workloads and Pods.
- Manage the availability of resources among your clusters.
- Refine and monitor practices and policies. Establish cost governance practices and policies based on the curated data uncovered by Kubernetes cost monitoring.
Configure or upgrade
Cost monitoring is a choice you can toggle on or off when you configure with Agent Flow mode.
If you have already deployed Kubernetes Monitoring using Agent or Agent Operator, follow the instructions to upgrade Kubernetes Monitoring.
Refine cost estimates
Cost monitoring estimates infrastructure costs based on the cluster provider ID and built-in pricing guides. However, the default provider ID does not include cost adjustments that you receive from the vendor, such as discounts. To further refine the estimate to include any negotiated pricing that is specific to your account, visit these vendor links for instructions:
- AWS
- Azure
- GCP
- Enable the Cloud Billing API.
- Create an API key, and optionally edit the key and restrict to the Cloud Billing API.
- Edit the OpenCost Deployment on the Kubernetes cluster, and set the
CLOUD_PROVIDER_API_KEY
to the newly created API key.
If you use a cluster provider other than the top three vendors, refer to Managing with the OpenCost Helm chart to configure custom pricing.
Related resources from Grafana Labs


