Skip to content

ax local start takes 3–5 minutes on a fresh cluster #689

Todo

Description

@rakyll

On a machine with no existing cluster, ax local start takes 3–5 minutes before the first task can run. A second run against the same cluster is fast because substrate.Bootstrap takes its alreadyHealthy fast path, so the cost is all in first-time setup. That is a lot of waiting for a first impression, and for make test-local-install in CI.

What a fresh start does

These steps run one after another, and most of them block on a readiness wait:

  1. Create the Kind cluster and wait for nodes to be Ready (internal/install/cluster/kind.go, --timeout=120s).
  2. Download kubectl if needed (executil.EnsureKubectl).
  3. Bootstrap Agent Substrate (internal/install/substrate/bootstrap.go):
    1. Create namespaces, apply the CRDs, and wait for them to be Established.
    2. Create the CA pools, apply podcertificate-controller, and wait for its rollout.
    3. Apply the gVisor SandboxConfig.
    4. Deploy the bundled PostgreSQL and wait for postgres-0 to be Ready, then initialize the schema and roles.
    5. Create the ate-system PKI pools, ConfigMaps and Secrets.
    6. Apply the control-plane bundle and wait for each component's pods to be Ready.
    7. Create the default gVisor WorkerPool and wait for it.
  4. Deploy AX (internal/install/axdeploy): Postgres and ax-server, waiting for their rollouts (3 minute timeout each).

Each pod in steps 3 and 4 also has to pull its image into the Kind node on first use, unless the image is preloaded.

What we don't know yet

We have no per-step timing, so we don't know whether the time goes to image pulls, to readiness waits that could overlap, to the WorkerPool coming up, or to the polling intervals of the waits themselves.

Proposed next steps

  • Print or trace how long each step takes during ax local start (the CLI already has ax --trace), and record a breakdown on a fresh macOS and Linux machine and in the local-install CI job.
  • Depending on what that shows:
    • Preload or pull images in parallel up front (kind load or a pull-ahead DaemonSet) instead of letting each rollout pull its own.
    • Apply the independent manifests together and wait for them at the end, instead of applying and waiting one step at a time. For example, PostgreSQL, the podcertificate-controller, and AX's own Postgres don't depend on each other.
    • Shorten the polling intervals of the readiness waits.
  • Show progress during long waits so the command doesn't look hung (see ax local start hangs #648).

Activity

  1. modified the milestones: v0.4.0, v0.5.0 on Nov 22, 2026
  2. self-assigned this
    on Nov 25, 2026
  3. Jefftree commented on Nov 25, 2026

    @Jefftree
    Collaborator

    Timed a fresh ax local start at 651fd23 (Linux, v0.4.0-rc.2 server image, Kind node image already cached) and checked the last 5 main Local install CI runs (e.g. job 139475931659). Cold start took 109.8s locally (4.9s warm) and 102.4 - 142.1s in CI.

    Stage Local CI (5 runs)
    Kind create + node readiness 37.2s 36.5 - 45.9s
    Substrate CRDs, podcert, Postgres 29.2s 17.4 - 34.6s
    Substrate control plane + WorkerPool 19.7s 22.1 - 37.7s
    AX authz, Postgres, ax-server 23.0s 20.0 - 23.9s
    Total 109.8s 102.4 - 142.1s

    Answering the four unknowns from the logs and kubelet events:

    • Image pulls: Kind already pulls 4 images in parallel, so all 18 pod images overlapped into ~21s on a fast link. On slower links the ~1.20 GB total (+914 MB for the Kind node if uncached) adds up fast, and making the optional telemetry stack opt-in (285 MB) plus aligning AX onto Postgres 18 instead of 17 (117 MB) trims about a third of that.
    • Readiness waits that could overlap: AX Postgres has no Substrate dependency (deploy/postgres.yaml), so starting it earlier overlaps its 14s behind Substrate. Substrate's own Postgres mounts podcert volumes (04-postgres.yaml:193-213), so applying it earlier mainly overlaps PVC setup and image pull. The biggest non-pull waits are Kind node readiness (~21s), trust bundles (~10s), and local-path PVC setup (4 to 5s each).
    • WorkerPool: not a bottleneck, taking 2.9s locally (1.9 - 4.0s in CI).
    • Polling intervals: rollout waits already use Kubernetes watches (rollout.go:84) and print pod status every 15s, with only two small polling loops (1s and 2s). Tightening container readiness probe intervals (currently 5s) saves more than changing CLI waits.
    Timestamped ax local start output (109.83s)
    +   0.08s (+  0.08s) | Downloading kind v0.32.0 to /tmp/ax-bench-689/ax-home/bin/kind...
    +   0.69s (+  0.61s) | ==> Creating Kind cluster "ax-bench-689" (kindest/node:v1.36.1@sha256:3489c7674813ba5d8b1a9977baea8a6e553784dab7b84759d1014dbd78f7ebd5)...
    +   0.83s (+  0.15s) | Creating cluster "ax-bench-689" ...
    +   0.83s (+  0.00s) |  • Ensuring node image (kindest/node:v1.36.1) 🖼  ...
    +   0.90s (+  0.07s) |  ✓ Ensuring node image (kindest/node:v1.36.1) 🖼
    +   0.90s (+  0.00s) |  • Preparing nodes 📦   ...
    +   4.40s (+  3.50s) |  ✓ Preparing nodes 📦 
    +   4.46s (+  0.05s) |  • Writing configuration 📜  ...
    +   4.92s (+  0.46s) |  ✓ Writing configuration 📜
    +   4.92s (+  0.00s) |  • Starting control-plane 🕹️  ...
    +  15.62s (+ 10.71s) |  ✓ Starting control-plane 🕹️
    +  15.62s (+  0.00s) |  • Installing CNI 🔌  ...
    +  16.15s (+  0.53s) |  ✓ Installing CNI 🔌
    +  16.15s (+  0.00s) |  • Installing StorageClass 💾  ...
    +  16.73s (+  0.58s) |  ✓ Installing StorageClass 💾
    +  17.09s (+  0.36s) | Set kubectl context to "kind-ax-bench-689"
    +  37.93s (+ 20.84s) | ==> Installing Agent Substrate v1.0.0 (local profile)...
    +  52.37s (+ 14.44s) | ==> Starting Substrate PostgreSQL and initializing mTLS roles...
    +  67.12s (+ 14.75s) | ==> Deploying Substrate control plane, router, and k8s-credential-provider...
    +  83.90s (+ 16.78s) | ==> Deploying gVisor WorkerPool (1 replica(s))...
    +  86.82s (+  2.92s) | ==> Configuring Agent Substrate permissions for ax-system/ax-server...
    +  87.57s (+  0.75s) | ==> Deploying ax-postgres in namespace "ax-system"...
    + 101.84s (+ 14.27s) | ==> Deploying ax-server (ghcr.io/google/ax/ax-server@sha256:0f2e31a9c6e143df613dd7cb03460b8ea48169305268022f92a96503894aefbd)...
    + 109.83s (+  7.98s) | ==> AX is ready in namespace "ax-system".
    + 109.83s (+  0.00s) | Local environment "ax-bench-689" is ready (active context: kind-ax-bench-689).
    
    Kubelet Pulled, NodeReady, PVC, and FailedMount events
    # Image pulls (18 unique images, 1,202,962,495 bytes)
    2026-11-25T20:42:46Z  podcertificate-controller-system/podcertificate-controller-7f674bb75f-s7s5t  Successfully pulled image "ghcr.io/agent-substrate/substrate/podcertcontroller:v1.0.0@sha256:1005579b2142f63412507342f095894eb435fe3736607f32dbad406d0e05c5a5" in 1.579s (1.579s including waiting). Image size: 32776796 bytes.
    2026-11-25T20:43:06Z  ate-system/postgres-0  Successfully pulled image "postgres:18-alpine@sha256:9a8afca54e7861fd90fab5fdf4c42477a6b1cb7d293595148e674e0a3181de15" in 3.493s (3.493s including waiting). Image size: 119995681 bytes.
    2026-11-25T20:43:14Z  ate-system/ate-api-server-799d88f774-rmstm  Successfully pulled image "ghcr.io/agent-substrate/substrate/objectstore-plugin:v1.0.0@sha256:485cf92b31fed761c53f478d17ed69bf552a2cd8e8cf3b24b98a3e06789ee274" in 1.611s (1.611s including waiting). Image size: 30919581 bytes.
    2026-11-25T20:43:14Z  ate-system/ate-controller-67b666b6d7-qxcvp  Successfully pulled image "ghcr.io/agent-substrate/substrate/atecontroller:v1.0.0@sha256:44b3a127048e1da8c15dff35f65defe73f4e54ebb985bc020aa9bb0e6eb029b2" in 1.636s (1.637s including waiting). Image size: 42647754 bytes.
    2026-11-25T20:43:15Z  ate-system/atelet-czmpf  Successfully pulled image "ghcr.io/agent-substrate/substrate/objectstore-plugin:v1.0.0@sha256:485cf92b31fed761c53f478d17ed69bf552a2cd8e8cf3b24b98a3e06789ee274" in 257ms (1.761s including waiting). Image size: 30919581 bytes.
    2026-11-25T20:43:15Z  otel-system/jaeger-f76d9bc75-mnhh8  Successfully pulled image "jaegertracing/jaeger:2.22.0@sha256:836b967b5abcf1f7758066aa6b348619267a2f1459f72d472840570f9bd88a17" in 1.909s (1.909s including waiting). Image size: 55079731 bytes.
    2026-11-25T20:43:16Z  ate-system/ate-idp-server-c4749559b-fc69c  Successfully pulled image "ghcr.io/agent-substrate/substrate/ate-idp-server:v1.0.0@sha256:9553c0e60a8ad8bbb1c54c59e59cf0d33a338bf4f883b6f806610dc407f49f7c" in 1.456s (1.911s including waiting). Image size: 13801329 bytes.
    2026-11-25T20:43:17Z  otel-system/opentelemetry-collector-8447d4dcb6-dlfmn  Successfully pulled image "otel/opentelemetry-collector-contrib:0.163.2@sha256:7f22d2a6748110ffb6a59bc0df448bccbf501cdb667d610ede4c61d3863d5849" in 2.901s (4.263s including waiting). Image size: 115792889 bytes.
    2026-11-25T20:43:17Z  otel-system/prometheus-7c49b8d5b7-w2d7g  Successfully pulled image "prom/prometheus:v3.15.1@sha256:fa3302279710be2f21a8301ec17a8b4f2301fd829bd113839b3b6b02b6f191a2" in 2.705s (3.913s including waiting). Image size: 114084929 bytes.
    2026-11-25T20:43:18Z  ate-system/atenet-router-54bb6c897f-9ws2n  Successfully pulled image "ghcr.io/agent-substrate/substrate/atenet:v1.0.0@sha256:04f7d93dc3fb3deda688137077226c12ce2da41cd4753adff708e3737dc59e20" in 1.25s (1.25s including waiting). Image size: 46182621 bytes.
    2026-11-25T20:43:19Z  ate-system/ate-api-server-799d88f774-rmstm  Successfully pulled image "ghcr.io/agent-substrate/substrate/ateapi:v1.0.0@sha256:2f1ee444b126b6e3620045b61d2a87507fb0f889da0249656c474ab59dc2beaf" in 1.575s (2.303s including waiting). Image size: 54906152 bytes.
    2026-11-25T20:43:19Z  ate-system/atelet-czmpf  Successfully pulled image "ghcr.io/agent-substrate/substrate/atelet:v1.0.0@sha256:79abc69f982392adbcbc3332cd8191cf74ac3cd1f4a43c44e9c8a3ce16488b6e" in 1.729s (1.757s including waiting). Image size: 61614714 bytes.
    2026-11-25T20:43:19Z  ate-system/k8s-credential-provider-ff4f985df-cbcdm  Successfully pulled image "ghcr.io/agent-substrate/substrate/kubernetes-secrets:v1.0.0@sha256:21d494e2461d920bb03a66a0cdf574835c7d2e019b7941acef675ecff5702344" in 1.392s (1.73s including waiting). Image size: 35171429 bytes.
    2026-11-25T20:43:22Z  ate-system/atenet-egress-69c4f86c5b-jqstn  Successfully pulled image "ghcr.io/agent-substrate/substrate/envoy-dataplane:v1.0.0@sha256:fc8e4c3ee9060a01153e4d4af571f3db294e60d536422e8a8c2996fa4a72bf8b" in 235ms (235ms including waiting). Image size: 72352048 bytes.
    2026-11-25T20:43:22Z  ate-system/atenet-router-54bb6c897f-9ws2n  Successfully pulled image "ghcr.io/agent-substrate/substrate/envoy-dataplane:v1.0.0@sha256:fc8e4c3ee9060a01153e4d4af571f3db294e60d536422e8a8c2996fa4a72bf8b" in 3.431s (4.349s including waiting). Image size: 72352048 bytes.
    2026-11-25T20:43:22Z  ate-system/rustfs-5fb848d4c9-8dmwx  Successfully pulled image "rustfs/rustfs:1.0.3@sha256:9ca9559533b537d10482fe923288b676ad08f92a7069d9a17327fbae3cab688b" in 2.638s (3.623s including waiting). Image size: 114595246 bytes.
    2026-11-25T20:43:23Z  ate-system/rustfs-bucket-init-57h5s  Successfully pulled image "amazon/aws-cli:2.38.5@sha256:c8156a0e74e13929a42d7e60f0d4e14e7d28d980cd21822505d4bff80e5460c1" in 10.06s (10.06s including waiting). Image size: 141150807 bytes.
    2026-11-25T20:43:30Z  ate-workers/ax-workers-557c886bff-wxhrb  Successfully pulled image "ghcr.io/agent-substrate/substrate/ateworker-gvisor:v1.0.0@sha256:f8987236c6256f58c4b2625e543b43f4ae4bdded6ee6821c03d966effb7c0f17" in 898ms (898ms including waiting). Image size: 22258836 bytes.
    2026-11-25T20:43:40Z  ax-system/ax-postgres-0  Successfully pulled image "postgres:17-alpine" in 3.387s (3.387s including waiting). Image size: 117384993 bytes.
    2026-11-25T20:43:48Z  ax-system/ax-server-6c87595877-m9wmj  Successfully pulled image "ghcr.io/google/ax/ax-server@sha256:0f2e31a9c6e143df613dd7cb03460b8ea48169305268022f92a96503894aefbd" in 883ms (883ms including waiting). Image size: 12246959 bytes.
    
    # Non-pull wait signals
    2026-11-25T20:42:41Z  (x1) ax-bench-689-control-plane  NodeReady: Node ax-bench-689-control-plane status is now: NodeReady
    2026-11-25T20:43:01Z  (x1) ate-system/data-postgres-0  ProvisioningSucceeded: Successfully provisioned volume pvc-8745b24f-c77a-419a-b8dd-66d0f6470abd
    2026-11-25T20:43:13Z  (x2) ate-system/ate-idp-server-c4749559b-fc69c  FailedMount: MountVolume.SetUp failed for volume "servicedns" : credential bundle is not issued yet
    2026-11-25T20:43:14Z  (x3) ate-system/atenet-router-54bb6c897f-9ws2n  FailedMount: MountVolume.SetUp failed for volume "servicedns" : credential bundle is not issued yet
    2026-11-25T20:43:15Z  (x3) ate-system/k8s-credential-provider-ff4f985df-cbcdm  FailedMount: MountVolume.SetUp failed for volume "servicedns" : credential bundle is not issued yet
    2026-11-25T20:43:17Z  (x4) ate-system/atenet-egress-69c4f86c5b-jqstn  FailedMount: MountVolume.SetUp failed for volume "servicedns" : credential bundle is not issued yet
    2026-11-25T20:43:35Z  (x1) ax-system/data-ax-postgres-0  ProvisioningSucceeded: Successfully provisioned volume pvc-bdd99111-0e97-43c8-89b9-7babc232a04e
    2026-11-25T20:43:41Z  (x2) ax-system/ax-postgres-0  Unhealthy: Readiness probe failed: /run/postgresql:5432 - no response
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions