Skip to main content
opsctl is the command-line interface for Autopilot. It provides interactive cluster analysis, rebalancing, resource prediction, and CRD status inspection without requiring the full controller to be running.
opsctl keeps its original command name — it is a runtime binary, not a brand name.

Installation

Build from source:
The binary is placed at bin/opsctl. Move it onto your PATH:
Prerequisites:
  • A valid kubeconfig file (defaults to ~/.kube/config)
  • For GKE mode: GCP credentials configured (gcloud auth application-default login)
  • For the predict command: a reachable Prometheus endpoint

Commands

rebalance (default)

Analyze cluster resource distribution and optionally rebalance pods across nodes. This is the default command when no subcommand is specified.
GKE provision-first mode flags — when --gke is set, opsctl provisions new nodes before migrating workloads, avoiding resource contention during rebalancing:

predict

Predict resource usage trends and detect anomalies using Prometheus historical data.
When both --namespace and --pod are provided, opsctl runs a detailed single-pod prediction including trend analysis, pattern classification, forecasting, peak estimation, and anomaly detection. When only --namespace is given (or neither), it runs a cluster-wide analysis with node utilization and fragmentation scoring.

status

Show the current state of all Autopilot CRD resources in the cluster.
Displays tables for RebalancePolicy (schedule, dry-run mode, last run), NodeScalingPolicy (min/max nodes, current/desired counts, last action), and PodResizePolicy (resize mode, recommendation count, total resizes).

help

Common usage examples

Dry-run cluster analysis (default)

Gathers cluster state, prints a node utilization table, computes the imbalance score, and lists proposed pod movements without executing anything. Since --dry-run defaults to true, this is always safe.

Execute rebalancing

Only movements that improve the imbalance score are executed. Pods are evicted through the Kubernetes eviction API, which respects PodDisruptionBudgets.

Adjust thresholds

GKE provision-first rebalance (dry-run)

GKE provision-first rebalance (execute)

Predict resource usage for a specific pod

Check CRD status

Exit codes

All errors are printed to stderr with a descriptive message. Diagnostic output (node tables, analysis results) goes to stdout.

Tips

  • Always start with a dry run. The default --dry-run=true ensures no cluster changes are made until you explicitly opt in.
  • In GKE mode, --spot can reduce costs by 60–91% for new nodes, but spot VMs can be preempted — use it for fault-tolerant workloads.
  • The predict command requires at least 5 historical data points from Prometheus. If your retention is too short, predictions won’t be available.
  • The status command works even if the controller is not running — it reads CRD resources directly from the API server.