Building Our Own App Platform: The Image Address the Node Couldn't Pull

We're building a self-sufficient app-building platform. An AI agent builds the apps, our own git server, mesh, builds the container images, and a GitOps controller deploys them to a k3s cluster on hardware I own instead of a hosted platform. I've written about why I chose to own the whole chain and about how the GitOps deploys work. This post is about one detail of that deploy step, and the outage it almost caused.

An image address gets written by whoever builds the image, and read by whoever pulls it. Those two can see different networks. When they do, the deploy fails at the worst possible step.

What happened

I moved my build system so that every app's image is built in an isolated build pod. The build step pushes the image and writes its address into the deploy repo, and the controller rolls it out.

The build pod pushes to the registry by its in-cluster name: registry.mesh-system.svc.cluster.local:5000. That's the name it can reach. Every manifest had always pulled from a different name: registry.local:5000.

So the first deploy would have written an address the cluster had never pulled from before.

Why it would have taken the site down

Kubernetes doesn't pull images itself. The node's container runtime does (containerd, on k3s). It runs on the node, outside the cluster's DNS, so it normally can't resolve *.svc.cluster.local names.

The other half: fieldmappings.com deploys with strategy: Recreate and one replica. The old pod stops before the new one pulls its image. If the pull fails, nothing is serving the site.

We caught it by reading the build log before the first real deploy: the image was pushed under one name, and the manifest pulled from another.

The fix

k3s reads a registry config from /etc/rancher/k3s/registries.yaml on the node. I mapped both names to the same registry (the full file):

mirrors:
  "registry.local:5000":
    endpoint:
      - "http://localhost:30500"
  "registry.mesh-system.svc.cluster.local:5000":
    endpoint:
      - "http://localhost:30500"

localhost:30500 is the registry's NodePort, which the node can always reach. Now whichever name a manifest uses, the node pulls from the same place. k3s only reads this file at startup, so restart k3s after changing it.

Result

All eight of my apps moved to the new build pipeline, one at a time, with each deploy checked live. The only downtime was the 10–20 second gap each Recreate restart takes.

The other options

The mirror was the smallest change, and it keeps both names working.

Checklist

Before the first deploy from a new build setup:

This is the same rule as GitOps Only Controls What You Write Down: anything a manifest leaves to be resolved gets resolved by whoever reads it. Here, the reader was the node.