Skip to main content

kubernetes-rec

Last updated on

Kubernetes Recommendations

Important to note
  • Node pool recommendations do not support node pools with autoscalers enabled.
  • These recommendations should be treated as a nudge, not a source of accurate cost data in such cases.
  • Please note: cost data might be incorrect for autoscaled node pools. To hide node pool recommendations for autoscaled pools, kindly reach out to Harness Support

Before You Begin

Harness CCM uses labels to process node pool recommendations. Make sure to add one of the labels listed to the Kubernetes nodes in your cluster. The following table shows the labels for the respective cloud providers:

Cloud providerLabels
Amazon Web Services (AWS)
  • eks.amazonaws.com/nodegroup​
  • alpha.eksctl.io/nodegroup-name​
  • node-pool-name​
  • kops.k8s.io/instancegroup
  • nodegroup​
Google Cloud Platform (GCP)
  • cloud.google.com/gke-nodepool
  • nodegroup​
  • kops.k8s.io/instancegroup
Microsoft Azure
  • Agentpool​
  • node-pool-name​
  • nodegroup​
  • kops.k8s.io/instancegroup

Types of Nodepool Recommendations

  • Node Pool Rightsizing: Node Pool Rightsizing is a strategy that analyzes your Kubernetes infrastructure to identify opportunities for more efficient resource allocation.

How Are Nodepool Recommendations Computed?

note

For nodepool recommendations, we base our calculations using public pricing data, which may differ from actual price.

The node pool recommendations are computed by analyzing historical utilization data and requests metrics of Pods. CCM recommends the optimal resource configurations for the Spot and On-demand instances. It uses the following parameters to determine the maximum node counts:

  • Total CPUs
  • Total memory
  • Max CPUs
  • Max Memory

The recommendations are calculated by aggregating the resource utilization and request across all pods running across nodes in the node pool. You can select the number of days to compute recommendations based on the utilization data. The available options are last 7, 30, 60, and 90 days.

Recommendation Calculation Formula

Nodepool Recommendation = Max at a given instant [Aggregated Max(Resource Utilization, Resource Requests)]

Detailed Example

To illustrate how nodepool recommendations are computed, let's walk through a practical example with two nodes in a nodepool, each running two pods. We'll analyze CPU utilization and requests at two different time points.

Time Instant 1

NodePodCPU UtilizationCPU Request
Node 1Pod 12.1 vCPU4.0 vCPU
Pod 21.4 vCPU1.0 vCPU
Node 2Pod 11.1 vCPU4.0 vCPU
Pod 20.9 vCPU1.0 vCPU

Time Instant 2

NodePodCPU UtilizationCPU Request
Node 1Pod 12.2 vCPU4.0 vCPU
Pod 21.5 vCPU1.0 vCPU
Node 2Pod 12.0 vCPU4.0 vCPU
Pod 20.3 vCPU1.0 vCPU

Calculation Process

For each pod, we take the maximum of its utilization and request, then sum these values for all pods at each time instant:

Time Instant 1:

Total = Max(2.1, 4.0) + Max(1.4, 1.0) + Max(1.1, 4.0) + Max(0.9, 1.0)
Total = 4.0 + 1.4 + 4.0 + 1.0 = 10.4 vCPU

Time Instant 2:

Total = Max(2.2, 4.0) + Max(1.5, 1.0) + Max(2.0, 4.0) + Max(0.3, 1.0)
Total = 4.0 + 1.5 + 4.0 + 1.0 = 10.5 vCPU

Final Recommendation

The final CPU recommendation is the maximum value across all time instants:

Recommended CPU = Max(10.4, 10.5) = 10.5 vCPU

Recommendation Drilldown

  • Potential Monthly Spend: Projected cost with and without recommendations

  • Potential Monthly Savings: Expected monthly cost reduction

  • Current and Recommended:

    • Estimated Savings
    • Instance Family
    • Node Count
    • CPU (vCPU)
    • Memory (GiB)
    • Cost per node per hour
    • Region
    • Potential monthly cost (current and after recommendation) The recommended values show Spot and On-demand configurations, estimated savings and potential monthly cost.
  • Cluster details and Resource Utilization (CPU, Memory, Node Count) in the last X days where X is the number of days selected for the recommendation (7,30,60 or 90).

  • Tune recommendations: You can either set a preset or tune your recommendations by modifying:

    • Minimum Node count
    • Percentage Buffer to be considered for CPU/Memory values
    • Preferred Instance families: All or Specified.
    • Minimum Workload Requirements (CPU and RAM): These are calculated using the peak historical CPU and memory usage observed on the nodes. You can adjust the values if needed.
    • Preferred Resource Requirements(CPU and RAM): These are calculated by aggregating CPU and memory usage and requests from all pods running across nodes in the node pool. You can adjust the values if needed. As and when these values are adjusted, the recommendationed values are computed based on these values.