Module metrics_client

Module metrics_client 

Source
Expand description

Kubernetes metrics-server client. Kubernetes Metrics Client for live cluster resource usage.

Connects to a Kubernetes cluster and fetches actual CPU/memory usage from the metrics-server API. This provides the “ground truth” data needed for precise right-sizing recommendations.

§Prerequisites

  • Valid kubeconfig (uses default context or specified context)
  • metrics-server installed in the cluster
  • RBAC permissions to read pods and metrics

§Example

use syncable_cli::analyzer::k8s_optimize::metrics_client::MetricsClient;

let client = MetricsClient::new().await?;
let metrics = client.get_pod_metrics("default").await?;

for pod in metrics {
    println!("{}: CPU={}, Memory={}", pod.name, pod.cpu_usage, pod.memory_usage);
}

Structs§

ContainerMetrics
Metrics for a single container.
ContainerResources
Resource specifications for a container.
MetricsClient
Kubernetes metrics client.
PodMetrics
Metrics for a single pod.
PodResources
Resource specifications from pod spec.
ResourceComparison
Comparison between requested and actual resource usage.

Enums§

MetricsError
Error type for metrics client operations.