Skip to content

install: serve localhost registry images to the local cluster - #666

Merged
aojea merged 1 commit into
mainfrom
local-start-loopback-registry
Nov 21, 2026
Merged

aojea merged 1 commit into
mainfrom
local-start-loopback-registry

Conversation

@aojea

@aojea aojea commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

ax local start cannot start ax-server from an image on a localhost registry. Before release images exist, that is the only registry a developer has without an external one. The symptom is the one in #648: ax-server stays Pending, and ax get tasks fails with pod is not running. Current status=Pending.

Reproduce

On main at de7de90, Linux, Docker 29.8, kind v0.33:

docker run -d -p 127.0.0.1:5001:5000 --name kind-registry registry:2
make images AX_IMAGE_REPO=localhost:5001 CONTAINER_CLI=docker
export AX_SERVER_IMAGE=localhost:5001/ax-server@$(cat bin/ax-server.digest)
export AX_DEFAULT_TASK_IMAGE=localhost:5001/ax-task-runner@$(cat bin/ax-task-runner.digest)
ax local start

It fails after 4 min 46 s. These commands were run before #647 removed the default task image; on current main, omit the AX_DEFAULT_TASK_IMAGE line. On main at 465cbeb, the smoke test that this PR adds runs the same steps and fails in the same way after 5 min. Since #655 the wait shows the reason:

==> Deploying ax-server (localhost:5001/ax-server@sha256:2672...)...
    ax-system/deployment/ax-server is not ready: pod ax-server-7df867bf6-m57vs, container ax-server: ImagePullBackOff: Back-off pulling image "localhost:5001/ax-server@sha256:2672...": ErrImagePull: ... Head "https://localhost:5001/v2/ax-server/manifests/sha256:2672...": dial tcp [::1]:5001: connect: connection refused
Error: waiting for ax-system/deployment/ax-server rollout: timed out after 3m0s: pod ax-server-7df867bf6-m57vs, container ax-server: ImagePullBackOff: ...

During the wait, in a second terminal (seen on 212bf13, not run again on de7de90):

$ ax get tasks
Error: kubectl port-forward exited for context "ax-local": error: unable to forward port because pod is not running. Current status=Pending

Cause

In the Kind node, localhost:5001 is the node itself, and no registry listens there. The host resolves the digest without error, because the registry is on the host's localhost.

The Agent Substrate manifests that ax embeds are Substrate's kind overlay. In them atelet has --localhost-registry-replacement=kind-registry:5000, so actor images on a loopback registry come from a container named kind-registry. Substrate's hack/create-kind-cluster.sh creates that container, connects it to the kind network, and writes /etc/containerd/certs.d/localhost:<port>/hosts.toml on each node. ax local start creates the cluster in Go and does not do the last two steps. So the node cannot pull pod images from localhost, and ax-server is the first one. atelet can reach kind-registry only when the container is already on that network.

Change

  • ax local start reads the registry that serves localhost images from the embedded Substrate manifests: installsubstrate.LocalRegistryEndpoint returns the value of atelet's --localhost-registry-replacement. It gives that endpoint and the image references of the install to the Kind provider (UpOptions.LocalRegistry, UpOptions.Images). No Go file names the registry.

  • For the references on localhost or a loopback address, KindProvider.Up:

    • checks, before it creates a cluster, that the container that the endpoint names is running, and stops with the command to start it when it is not;
    • connects that container to the network of the nodes;
    • writes certs.d/<registry>/hosts.toml on each node, with the endpoint as the host.

    It does not create the registry, because the images must already be in it.

  • Test: make test-local-install (hack/test-local-install.sh) builds the images into a registry on localhost, runs ax local start with them, and runs a task from a locally built image. No test ran ax local start on a cluster before: E2E installs AX with Substrate's own tools. CI runs it as the job local-install in e2e.yml, with the triggers of E2E. It is not a required check.

  • Docs: a "Using Locally Built Images" section in docs/local_installer.md, a pointer to it in the README, the new test in docs/development.md and AGENTS.md, and a row in the address table of the Substrate skill.

The registry container must still have the name and port of Substrate's kind overlay (kind-registry, 5000). The guide gives the command.

Result

With this change, rebased on main at 465cbeb, ax local start --server-image "$AX_SERVER_IMAGE" gives:

==> Creating Kind cluster "ax-local" (kindest/node:v1.36.1@sha256:3489...)...
==> Serving images on localhost:5001 from the "kind-registry" container...
==> Installing Agent Substrate v1.0.0 (local profile)...
...
==> AX is ready in namespace "ax-system".

Local environment "ax-local" is ready (active context: ax-local).
Check Result
New cluster, registry container not connected to the kind network Ready in 1 min 50 s
The task of Step 4 of the guide, with spec.profile.image on localhost:5001 Resumed in 3 s, ax ssh ran in the gVisor sandbox, /workspace survived suspend and resume
kind-registry container stopped Error in 0.1 s, no cluster created
Second run on a healthy cluster Deployment generation and pod unchanged, 4 s
make test-local-install with this change Passes: 2 min 14 s on a workstation, 4 min 23 s as the CI job
The same script on main at 465cbeb, without this change Fails after 5 min with the ImagePullBackOff reason, exit code 1

make verify, go build of the three binaries, and go test ./... pass.

Not verified: Podman as the cluster engine, and macOS. A server image on a remote registry was not run on a cluster; the unit tests cover that no registry is configured for it.

Not in this PR

A run after a failed run can still fail at once. The ax-server Deployment has the default progressDeadlineSeconds of 600. After that time, kubectl rollout status returns an error immediately, and kubectl apply of the unchanged manifest starts no new rollout. An earlier revision of this PR restarted the Deployment in that state. This revision does not.

Measured with the registry code of this PR, before the rebase on #647, on the failed cluster of the reproduction, 10 minutes after the Deployment was created:

  1. ax local start serves the registry to the cluster, then fails in 4 s with deployment "ax-server" exceeded its progress deadline.
  2. The kubelet retried the pull 59 s later, and the same pod started. The back-off between retries can be up to 5 minutes.
  3. The next ax local start is ready in 4 s.

Updates #648. The reproduction gives the error text of that issue, but the report does not show which image was used, so this is possibly not its cause. #655 covers images in a private registry and hosts without egress.

@aojea aojea self-assigned this Nov 20, 2026
Comment thread docs/local_installer.md Resolved
Comment thread internal/install/axdeploy/deploy.go Resolved
Comment thread internal/install/cluster/registry.go Resolved

@mayawang mayawang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Andrew! Nice that it only kicks in for localhost refs, so the ghcr path is untouched. Let's get it in before the rc cut

@aojea

aojea commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

@mayawang hold for a moment there are things that are not correct. I will undraft when is ready

@mayawang

Copy link
Copy Markdown
Collaborator

no rush, thanks Andrew! we'll pick it up for the next rc

@aojea
aojea force-pushed the local-start-loopback-registry branch from 35a4c1f to 9b4f7a7 Compare November 20, 2026 19:49
'ax local start' with an image on a localhost registry, such as
localhost:5001/ax-server, could not start ax-server. The Kind node pulled
the image from its own localhost, where no registry listens, so the pod
stayed Pending in ImagePullBackOff until the rollout wait timed out (#648).

The Agent Substrate manifests that 'ax local' installs already make atelet
pull the actor images of a loopback registry from kind-registry:5000. That
is the registry container of Substrate's hack/create-kind-cluster.sh, which
also connects the container to the network of the cluster and adds a
containerd mirror on each node. 'ax local start' creates the cluster itself
and did neither. So the node could not pull pod images, and atelet could
reach the container only when it was already on that network.

'ax local start' now reads that registry from the embedded manifests
(installsubstrate.LocalRegistryEndpoint) and gives it to the Kind provider
with the image references of the install. For the references on localhost
or a loopback address, KindProvider.Up connects the registry container to
the network of the nodes and adds the containerd mirror on each node.
Before it creates a cluster it checks that the container is running, and
stops with the command to start it when it is not. No Go file names the
registry.

No test ran 'ax local start' on a cluster: E2E installs AX with Substrate's
own tools. 'make test-local-install' (hack/test-local-install.sh) builds
the images into a registry on localhost, runs 'ax local start' with them,
and runs a task from a locally built image. It fails on main without this
change. CI runs it as the job local-install in e2e.yml.
@aojea
aojea force-pushed the local-start-loopback-registry branch from 9b4f7a7 to 3d9e1bd Compare November 20, 2026 20:46
Comment thread .github/workflows/e2e.yml
Comment on lines +94 to +100

# The only job that runs `ax local start`: the E2E job above installs AX
# with Substrate's own tools. It builds the AX images into a registry on
# localhost, as docs/local_installer.md describes, starts a local cluster
# from them, and runs a task. The Substrate it installs is the one embedded
# in ax, so substrate_ref does not apply.
local-install:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This jobs ensures we never regress on the user experience

@aojea
aojea marked this pull request as ready for review November 20, 2026 20:51
@aojea
aojea merged commit 7d3ba98 into main Nov 21, 2026
13 checks passed
@aojea
aojea deleted the local-start-loopback-registry branch November 21, 2026 00:19
@aojea

aojea commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

ok @mayawang fat fingers here should I revert or is ok to be merged ... I apologize I don't understand the workflows yet in this project

mayawang added a commit to mayawang/ax that referenced this pull request Nov 21, 2026
Keep google#666's localhost registry reference from README.md in docs/development.md#build-and-push-images alongside make images.

Verification:
- export GOTOOLCHAIN=auto && make verify (0 issues)
- go build ./cmd/ax ./cmd/ax-server ./cmd/ax-runner
- go test -count=1 ./... (all unit packages passed; Postgres and Kind E2E self-skip without env opt-in)

Part of google#661
Fixes google#680
aojea added a commit that referenced this pull request Nov 21, 2026
The local install job fails on main: hack/test-local-install.sh reads
bin/ax-task-runner.digest, and 'make images' writes bin/ax-runner.digest
since ax-task-runner was renamed to ax-runner (#677). #677 merged after
the last CI run of #666, which added the script, and before #666 merged,
so neither change saw the other.

The guide has the same command in "Using Locally Built Images", and a unit
test has the old name in two sample image references. Use the new name in
all three.

When the script fails before 'ax local start' creates a cluster, it no
longer prints the state of a cluster. There is none, and kubectl printed
only connection errors.
mayawang added a commit to mayawang/ax that referenced this pull request Nov 23, 2026
Keep google#666's localhost registry reference from README.md in docs/development.md#build-and-push-images alongside make images.

Verification:
- export GOTOOLCHAIN=auto && make verify (0 issues)
- go build ./cmd/ax ./cmd/ax-server ./cmd/ax-runner
- go test -count=1 ./... (all unit packages passed; Postgres and Kind E2E self-skip without env opt-in)

Part of google#661
Fixes google#680
mayawang added a commit to mayawang/ax that referenced this pull request Nov 23, 2026
Keep google#666's localhost registry reference from README.md in docs/development.md#build-and-push-images alongside make images.

Verification:
- export GOTOOLCHAIN=auto && make verify (0 issues)
- go build ./cmd/ax ./cmd/ax-server ./cmd/ax-runner
- go test -count=1 ./... (all unit packages passed; Postgres and Kind E2E self-skip without env opt-in)

Part of google#661
Fixes google#680
mayawang added a commit that referenced this pull request Nov 23, 2026
…uickstart (#678)

## Summary

Prepares zero-flag release `ax-server` installs, Studio bundling, and
simplified quickstart docs on `main` (ready to backport onto
`release-0.4` for `v0.4.0-rc.2`):

- **Release `ax-server` default (#661):** Replace empty
`DefaultServerImage` with `axdeploy.DefaultServerImage()`, returning
`version.Image("ax-server")` when `version.IsRelease()` is true so
`EnsureDigestPinned` pins the multi-arch `@sha256` digest at install
time. Unversioned dev builds still require `--server-image` or
`$AX_SERVER_IMAGE`, and `imageFlags.register` leaves flag defaults empty
so `$AX_SERVER_IMAGE` continues to take precedence over release
defaults. `DefaultRunnerVolumeImage` stays empty pending #661 / #625.
- **Pin AX Studio in `install.sh`:** Set
`PINNED_STUDIO_VERSION="v0.4.0-rc.1"` with verified SHA-256 digests from
[`agentexecutor/studio v0.4.0-rc.1`
checksums.txt](https://github.com/agentexecutor/studio/releases/tag/v0.4.0-rc.1)
for all four release platforms, update the printed next step to `ax
local start`, and update `TestInstallShStudioPinning`.
- **Move source image builds out of `README.md`:** Simplify `README.md`
quick start to `install.sh` (now installing both `ax` and `ax-studio`) +
`ax local start` / `ax install`, document that prebuilt agent images
with no runner baked in (such as Antigravity) need
`--runner-volume-image` from the release notes in `README.md` and
`docs/local_installer.md`, move `make images` instructions and the
`localhost` registry link from #666 to
`docs/development.md#build-and-push-images` (keeping `Using Locally
Built Images` in `docs/local_installer.md`), and update
`docs/releasing.md`.

Part of #661.
Fixes #680.

## Verification

```bash
export GOTOOLCHAIN=auto
make verify                                              # buf, go mod tidy, go fmt, golangci-lint: 0 issues
go build ./cmd/ax ./cmd/ax-server ./cmd/ax-runner        # passed
go test -count=1 ./...                                   # all unit packages passed (Postgres & Kind E2E self-skip without env opt-in)
sh -n install.sh                                         # passed
go build -ldflags "-X github.com/google/ax/internal/version.Version=v0.4.0-rc.2" -o /tmp/ax-rc2-check ./cmd/ax && /tmp/ax-rc2-check local --help
# Verified --server-image prints: (default: "ghcr.io/google/ax/ax-server:v0.4.0-rc.2")
```

cc @MushuEE for release-defaults review.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants