Hyphen

Kubernetes Optimizer

A guide to using the Kubernetes Optimizer feature in Hyphen Agent to analyze and recommend optimizations for Kubernetes workloads.

Hyphen Agent can analyze a workload in a registered Kubernetes cluster and recommend optimization changes. Kubernetes optimizer runs use cluster inventory, workload context, and connected observability signals to surface findings and replica guidance for a specific workload.

Use Kubernetes Optimizer when you want Agent to review whether a workload's current replica count matches expected demand, readiness, and recent cluster signals.

Table of Contents

Requirements

Kubernetes optimizer runs need:

  • A registered Kubernetes cluster with Horizon connected.
  • A recent inventory snapshot for the cluster.
  • A selected Kubernetes workload, including namespace, kind, and name.
  • Permission to view the cluster and run Agent tasks for the organization.
  • Permission to approve scale changes when approval is required.

For runtime metrics and logs, connect a supported provider from the cluster's Settings tab. See Kubernetes Observability. An observability connection is recommended but not required.

Agent can use workload and inventory signals such as:

  • Current and ready replicas.
  • Related pods, services, and warning events.
  • Sibling workloads that appear to belong to the same app.
  • Inventory truncation state.
  • Active planned events that may change expected demand.
  • HorizontalPodAutoscaler evidence when available.
  • CPU and memory request utilization, restart counts, and workload logs when a supported observability source is connected.

Automatic and Manual Runs

Kubernetes optimizer runs for a workload can be scheduled with a policy, or started manually.

Each Deployment or StatefulSet can have its own optimizer policy, configured from the cluster's Settings tab. A workload with no policy is not scanned automatically, but can still be optimized on demand. See Optimizer Policies.

You can start a Kubernetes optimizer run manually for a workload in a registered cluster in two ways:

  • Ask Hyphen Agent from chat. Agent uses attached cluster and workload context first. If the request is ambiguous, Agent asks you to identify the intended cluster or workload before creating the Kubernetes optimizer task.
  • Click Optimize now on a Deployment or StatefulSet's details panel in the cluster diagram.

Example prompts:

  • "Run optimizer for the checkout web deployment in the production cluster."
  • "Analyze the checkout/web workload replicas."
  • "Should this Kubernetes workload be scaled before the launch event?"

While a workload has an optimizer run in progress, the cluster diagram highlights its node. If the run needs a decision, the node also shows a badge you can use to jump to the run.

How It Works

Agent resolves the Kubernetes cluster and workload target, reads the latest workload inventory, and queries connected New Relic or Google Cloud telemetry when available. It analyzes the combined evidence for optimization opportunities.

Recommendations can include:

  • Findings about workload readiness, risk, or missing evidence.
  • Replica guidance when inventory supports a direct recommendation.
  • Capability gaps when Agent cannot make a safe recommendation from the available data.

Telemetry is bounded to the target workload, relevant pods, and the analysis time range. If a provider query fails or inventory cannot attribute pods precisely, Agent reports the missing evidence instead of treating it as a healthy signal.

If the workload appears to be managed by a HorizontalPodAutoscaler, Agent does not recommend manual replica changes. If autoscaling ownership is unknown, Agent calls out the uncertainty before recommending manual replica guidance.

Approvals and Guardrails

Kubernetes optimizer recommendations are review-first. Scale recommendations require explicit approval before anything changes.

Before applying an approved replica change, Hyphen rechecks the workload against the replica count that was reviewed. If the workload has changed, cannot be found, or appears to be managed by autoscaling, Agent skips the change and reports why.

If you reject a recommendation with a reason, the reason appears alongside the user who responded in the recommendation's details.

Results

Kubernetes optimizer task and run views show the selected cluster, workload, analyzed inventory context, findings, recommendation details, approval requests, and final output.

The run view includes a scope summary (the workload analyzed and its size) and an evidence strip showing the metrics Agent used, each with its trend over the analysis window, the sample count, and the observability provider.

After an approved scale change, Hyphen refreshes inventory so you can review the updated cluster state.

Things to Know

  • Kubernetes optimizer work is scoped to one workload in one registered cluster per run.
  • Horizon must be connected before Agent can inspect workload inventory.
  • Agent does not request or use Kubernetes Secret data for optimizer analysis.
  • Inventory gaps or truncated inventory can lower recommendation confidence.
  • Missing or partial observability signals can lower recommendation confidence but do not prevent inventory-only analysis.
  • Manual replica guidance is skipped when matching HorizontalPodAutoscaler evidence is detected.