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§
- Container
Metrics - Metrics for a single container.
- Container
Resources - Resource specifications for a container.
- Metrics
Client - Kubernetes metrics client.
- PodMetrics
- Metrics for a single pod.
- PodResources
- Resource specifications from pod spec.
- Resource
Comparison - Comparison between requested and actual resource usage.
Enums§
- Metrics
Error - Error type for metrics client operations.