Menu
Grafana Cloud

Optimize resource usage and efficiency

Kubernetes resources that aren’t optimized can significantly impact both budget and performance:

  • An underprovisioned Kubernetes infrastructure leads to lagging, underperforming, unstable, or non-functioning applications.
  • An overprovisioned infrastructure becomes costly.

To manage CPU, RAM, and storage, and mitigate the threat of an unstable infrastructure, you must:

  • Ensure that there are enough allocated resources. This decreases the risk of Pod or container eviction as well as undesired performance of your microservices and applications.
  • Eliminate unused or stranded resources.

Create an efficiency feedback loop

With Kubernetes Monitoring, you can discover:

  • Resource-intensive workloads and Pods
  • Unused and stranded resources in your fleet
  • Stability issues created by incorrect configuration of requests and limits for CPU and memory usage
  • How current data compares with historical data using the time range selector

Using this data, you can:

  • Iteratively solve problems caused by incorrect configuration.
  • Improve Pod and namespace placement to optimize the usage of the resources already available.
  • Manage the availability of resources among your Clusters.
  • Identify imperfections in resource management policy.

Identify and prioritize efficiency issues

With Kubernetes Monitoring, you can effectively identify, prioritize, and handle efficiency-related issues. In this example, the home page shows within the Pods in trouble section a list of Pods that exceed specific thresholds. Alerts for CPU throttling are firing.

Troubleshooting path for CPU throttling
Troubleshooting path for CPU throttling

When you click a Pod in the list, the Pod detail page appears, showing:

  • Continuous bursting for both CPU and memory
  • A list of all containers within the Pod

When you click a container in the list, the container detail page appears and shows:

  • The bursting pattern
  • The requests and limits for CPU and memory have been outgrown since they were last set. Recommendations guide you toward the correct settings. The CPU throttling graph on the container details page offers more insight.

For further information about setting CPU requests and limits, refer to:

View efficiency data throughout the app

The sections of the home page show any usage and capacity thresholds that have been exceeded for Node CPU and disks, Node memory, and Persistent Volumes.

Sections of home page showing thresholds exceeded
Sections of home page showing thresholds exceeded

On the Cluster navigation page, use the Clusters, Namespaces, Workloads, and Nodes tabs to view CPU and memory usage for each item in the list.

CPU and memory usage indicated for each Cluster in the list
CPU and memory usage indicated for each Cluster in the list

When you view the Namespaces, Workloads, and Nodes lists, the Cluster column is filtered by default for the first Cluster, to decrease page load time, as shown in this screenshot.

List of Nodes filtered for the amwins Cluster
List of Nodes filtered for the amwins Cluster

Discover usage over time

Use the time range selector to identify resource usage peaks and avoid performance degradation.

Pod details page showing activity over last six hours
Pod details page showing activity over last six hours

See an overview of efficiency

The Efficiency page provides a snapshot CPU, memory, and storage for all Clusters, Nodes, and namespaces.

**Efficiency** page showing usage for last hour
Efficiency page showing usage for last hour

What is calculated

Kubernetes Monitoring uses the following to determine the calculation of unused resources, stranded resources, and resource limits:

  • Unused resources: The average percentage of CPU, RAM, and storage that remain untouched for a certain period. When calculating unused resources, any momentary peaks in resource usage are averaged over the time window. These peaks can be above what’s expected at certain times. Calculations use resource requests set in your Kubernetes environment per best practices.

  • Stranded resources: Resources that become unusable due to bad Pod placement. When too many CPU-intensive Pods exist in one Node, this strands RAM. Even if RAM is available and not used, the scheduler won’t assign these Pods due to insufficient CPU in the Node. For example:

    Diagram of two nodes depicting stranded pods
    Example of evicted pod

    In this example, the team:

    • Paid for 10 GB RAM and 10 CPU (5 per Node per resource type)
    • Needed 8 GB RAM and 9 CPU
    • Used 5 GB RAM and 8 CPU
    • Still had their Pod evicted
  • Resource limits: The Kubernetes configuration that provides minimum and maximum resource constraints for a Pod or container.