What Autopilot does
Autopilot is a Kubernetes controller that continuously optimizes cluster cost and performance through four mechanisms:- Pod Resizing — Right-sizes container resource requests based on actual usage (in-place, no restarts on K8s 1.33+)
- Node Scaling — Adds and removes nodes based on demand, with per-pod machine type selection (heterogeneous scaling)
- Cluster Rebalancing — Redistributes pods across nodes to eliminate waste and enable node removal
- Scheduled Scaling — Pre-warms HPA targets before predictable traffic bursts
Architecture overview
Prerequisites
- GKE cluster (K8s 1.33+ recommended for in-place pod resizing)
kubectlconfigured with cluster accessgcloudauthenticated (gcloud auth application-default login)- Helm 3.x
- Docker or Depot CLI (for building images)
Initial setup
1. Bootstrap a cluster
Every cluster needs a one-time setup that creates service accounts, installs Prometheus, and generates the environment config:- Creates a GCP service account with
compute.admin+container.adminroles - Creates a node service account for heterogeneous VM provisioning
- Configures Workload Identity bindings
- Deploys kube-prometheus-stack to the
monitoringnamespace - Creates the
ops-ainamespace - Generates
deploy/envs/<cluster-name>.yamlwith cluster-specific values
Autopilot’s runtime identifiers — the
ops-ai namespace, the ops-ai.io CRD API group,
the opsctl CLI, and ops-ai.io/* annotations — keep their original names. They are code
and runtime identifiers, not brand names, and renaming them would break existing clusters.2. Deploy Autopilot
3. Verify
The four optimization engines
Each engine has its own deep-dive page. Here is how they fit together:Pod Resizer
Vertical optimization — right-sizes CPU/memory requests from Prometheus usage data.
Node Scaler
Horizontal infrastructure — NodePool or heterogeneous per-pod machine selection.
Cluster Rebalancer
Cost optimization — recomputes optimal node configs, provision-first or rolling drain.
Scheduled Scaler
Pre-warming — overrides HPA
minReplicas during defined time windows.Observability
Autopilot surfaces cluster and managed-service health in the same dashboard:- GCP managed services — read-only monitoring for Cloud SQL, Memorystore Redis, Cloud NAT, Storage, DNS, VPC Peering, Artifact Registry, and Secret Manager.
- Network monitoring — cluster throughput, top talkers, and per-node errors/drops, powered by existing Prometheus metrics with no extra agents.
- Package cost tracking — per-package cost attribution for tenant namespaces, with 6-hour snapshots for trend analysis.
Admin dashboard
The controller embeds an Angular SPA served on port 9090. Access it via:Dashboard pages
Configuration layers
Policy behavior is controlled at three layers. When changing defaults, all layers must be considered:- Code defaults — fallback when CRD fields are empty
- Helm values (
deploy/helm/ops-ai-controller/values.yaml) — installed as default CRDs on first deploy - Live CRDs on cluster — the actual runtime config (Helm only updates on install/upgrade)
Per-cluster configuration
Each cluster gets its own env file indeploy/envs/<cluster-name>.yaml:
Operational safety
What Autopilot never does
- Evicts pods without checking PodDisruptionBudgets
- Modifies Deployment templates (uses webhook injection instead)
- Resizes its own namespace (
ops-aiis always excluded) - Scales below
minNodesin the NodeScalingPolicy - Deploys automatically — always requires explicit
deploy-cluster.sh
Protection mechanisms
- CAST AI conflict detector — forces all policies to passive mode if CAST AI agents are detected
- Single-replica protection — temporarily scales to 2 replicas before evicting the sole pod
- Limit safety net — the webhook enforces minimum memory limits on all pod creates
- OOM death spiral detection — evicts pods stuck in OOM loops for webhook re-injection
- Circuit breaker — Prometheus failures degrade gracefully to metrics-server
Controller replica count
The controller runs with 1 replica using theRecreate deployment strategy. Do not
increase this — leader election and operational simplicity mean exactly 1 is correct, and a
restart is a 30–60s gap during which nothing time-critical is missed (the webhook fails open).
Monitoring the controller
- Slack alerts — infrastructure problems (pool capacity, Prometheus OOM/disk, pending pods, managed node count). Configure via
slack.secretNamein Helm values. - Sentry — captures all
error+ level logs. Configure viasentry.dsnin the per-cluster env file. - Prometheus metrics — exposed at
/metrics(port 8080); a ServiceMonitor ships with the Helm chart. - Grafana — a pre-built dashboard deploys automatically (
scripts/grafana.sh).
Release workflow
Next steps
opsctl CLI Guide
Detailed command reference for the CLI.
Operations Runbook
Day-to-day procedures, health checks, and disaster recovery.
Autopilot vs CAST AI
How Autopilot compares — transparency, cost model, and data residency.
API Reference
Every dashboard API endpoint.