mk4, the k3s cluster that ran jithendar.com on Hetzner, was built on Ampere servers, so every image I built was arm64 only. Then I moved to Contabo, whose Cloud VPS servers are amd64, and the first deploy there failed in every pod.
In this part I show how I rebuilt them so one tag works on both CPUs: one native GitHub Actions job per architecture, a publish job that joins the builds with docker buildx imagetools, and a check that refuses any tag missing a CPU. No QEMU, and no change to the manifests that pull them.

This is part 3 of a six-part series on moving jithendar.com's k3s cluster from Hetzner to Contabo. Part 2 (opens in a new tab) built the cluster, and part 4 (opens in a new tab) covers how GitHub Actions reaches it.
The first deploy to Contabo
On 30 November, with the cluster up and the pipelines able to reach it, I started the site's deploy workflow against Contabo (run 46420608820). It applied every manifest, and its image preflight passed with preflight images: ok. Then all three rollouts timed out:
##[error]deployment/jithendar-com did not become ready within 5 minutes
jithendar-com-79446cd598-xj7s5 1/2 Init:Error 5 (2m1s ago) 3m30s x.x.x.x worker-1
jithendar-com-8667c7869b-jbtck 1/2 Init:Error 5 (2m2s ago) 3m28s x.x.x.x worker-3
##[error]deployment/jithendar-com-worker did not become ready within 5 minutes
jithendar-com-worker-5c4454b758-sjdxj 1/2 Init:CrashLoopBackOff 6 (2m53s ago) 8m36s x.x.x.x worker-1
error: deployment "seo-agent" exceeded its progress deadline
seo-agent-6df965b6b8-6jnxr 1/2 CrashLoopBackOff 6 (4m1s ago) 10m x.x.x.x worker-2The pods stopped at their init container, practice-catalog, which does nothing but copy the practice problems into the pod. A copy only fails like that when the program can't start at all, and that was the problem: every image from ghcr.io/mrjithendar held a single arm64 build. The last moks-cms release before the change, pr-238, is a plain image manifest whose config says "architecture":"arm64". There is no list of platforms in it at all.
My preflight (scripts/preflight-deploy.py in the jithendar.com repository) only asks the registry whether a tag can be pulled without a login. It could. Nothing asked which CPU it was built for.
This is how moks-cms released before, in .github/workflows/ci-moks-cms.yml, on a single job running on ubuntu-24.04-arm:
docker build --platform linux/arm64 --provenance=false --build-arg "GIT_SHA=$RELEASE_SHA" --label "org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" -t "$REGISTRY_IMAGE:$PR_TAG" -t "$REGISTRY_IMAGE:latest" .The same was true for moks-cms-runner, the practice images and moks-rag-api. Three repositories, one fix.
Native runners, not QEMU
GitHub hosts both kinds of runner, ubuntu-24.04-arm and ubuntu-24.04, and my jobs already ran on the arm64 ones. The usual trick for a second architecture is QEMU, which emulates the other CPU. I didn't want my smoke tests to test an amd64 image on an arm64 machine through an emulator. So the plan: build each architecture on its own runner under its own tag, join them into the tags the clusters pull only when both have passed, and fail if a tag doesn't hold both.
One release job per CPU
In moks-cms the release job became a matrix (.github/workflows/ci-moks-cms.yml, from moks-cms #241 (opens in a new tab)):
release:
name: release (${{ matrix.arch }})
strategy:
# Nothing is published unless both pass, but a failure in one must not cancel the other halfway through a push.
fail-fast: false
matrix:
include:
- arch: arm64
runner: ubuntu-24.04-arm
- arch: amd64
runner: ubuntu-24.04
runs-on: ${{ matrix.runner }}
concurrency:
group: moks-cms-release-${{ matrix.arch }}
cancel-in-progress: falsefail-fast: false keeps one architecture's failure from cancelling the other halfway through a push; I want both logs when something breaks.
The concurrency group has the architecture in its name. Before, the job had one group, moks-cms-release. GitHub keeps only one pending job per group, so with two matrix jobs in one group, one architecture waits as "pending", and if another pull request is merged meanwhile, its job replaces the pending one. That release would never get its second architecture. With one group per architecture, each CPU's releases still go one at a time, in merge order.
Each job then builds, smoke-tests and pushes only its own tag:
docker build --platform "linux/$ARCH" --provenance=false --build-arg "GIT_SHA=$RELEASE_SHA" --label "org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" -t "$REGISTRY_IMAGE:$PR_TAG-$ARCH" .
docker push --quiet "$REGISTRY_IMAGE:$PR_TAG-$ARCH"
docker push --quiet "$RUNNER_IMAGE:$PR_TAG-$ARCH"At this point pr-242-arm64 and pr-242-amd64 exist in the registry, but pr-242 and latest, the tags a site pulls, haven't moved.
One tag, both CPUs
The publish job needs both release jobs. It joins the two builds into an image index, a list that says "for linux/arm64 use this digest, for linux/amd64 that one", in the registry, without rebuilding anything:
docker buildx imagetools create -t "$REGISTRY_IMAGE:$PR_TAG" "$REGISTRY_IMAGE:$PR_TAG-arm64" "$REGISTRY_IMAGE:$PR_TAG-amd64"
docker buildx imagetools create -t "$REGISTRY_IMAGE:latest" "$REGISTRY_IMAGE:$PR_TAG"Then it checks every tag it just wrote and fails unless the platforms are exactly the two I expect:
platforms="$(docker buildx imagetools inspect --format '{{json .Manifest}}' "$ref" |
jq -r '[.manifests[]?.platform | select(. != null and .os != "unknown") | "\(.os)/\(.architecture)"] | sort | join(" ")')"
echo "$ref: ${platforms:-none}"
if [[ "$platforms" != "linux/amd64 linux/arm64" ]]; then
echo "::error::$ref holds '${platforms:-no platform list}', not linux/amd64 and linux/arm64"
failed=1
fiThis is what it printed for the release of moks-cms #242 (opens in a new tab) (run 46428428724):
ghcr.io/mrjithendar/moks-cms:pr-242: linux/amd64 linux/arm64
ghcr.io/mrjithendar/moks-cms:latest: linux/amd64 linux/arm64
ghcr.io/mrjithendar/moks-cms-runner:pr-242: linux/amd64 linux/arm64
ghcr.io/mrjithendar/moks-cms-runner:sha-ac2480549bbe7b64c610b075554019f245b436f0: linux/amd64 linux/arm64
ghcr.io/mrjithendar/moks-cms-runner:latest: linux/amd64 linux/arm64The site's manifests name :latest with no architecture, so the jithendar.com repository didn't change. Each node picks its own entry.
The same pattern in two more repositories
practice-programming #9 (opens in a new tab) got the same shape: a build matrix with a concurrency group per architecture, then an images job that joins the three practice images and runs the same check.
moks-rag builds with docker/build-push-action instead of plain docker build, so it could use a layer cache. In .github/workflows/build-and-deploy.yaml (from moks-rag #27 (opens in a new tab)):
platforms: linux/${{ matrix.arch }}
push: true
tags: ${{ steps.meta.outputs.image_name }}:${{ github.sha }}-${{ matrix.arch }}
cache-from: type=gha,scope=rag-api-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=rag-api-${{ matrix.arch }}The scope carries the architecture: with one shared scope, the two builds would keep overwriting each other's cache. moks-cms still builds without a cache. [ASK JITHENDAR: Is that deliberate, or should moks-cms get the same per-architecture cache?]
What it cost in build time
| Release | arm64 | amd64 | Join |
|---|---|---|---|
| moks-cms before (six releases on 29 Nov) | 5m26s to 5m55s | none | none |
| moks-cms after (run 46428428724) | 5m26s | 5m07s, at the same time | 24s |
| practice-programming (run 46429770667) | 40s | 37s | 33s |
| moks-rag (run 46564803199) | 1m05s | 1m27s | 9s |
The wait for a release barely changed, because the two builds run side by side. What doubled is runner time: every image is now built twice. That lasts as long as both clusters run. [ASK JITHENDAR: Once mk4 is deleted, do you keep building arm64 images, or drop the arm64 jobs and go back to one build?]
One file only looks arm64-only: the SEO agent's reranker, ARG RERANKER_FILE=onnx/model_qint8_arm64.onnx in the moks-cms Dockerfile. "arm64" names the export's quantization recipe, and ONNX Runtime runs it on both CPUs. It's off by default, and I only measured its latency on arm64, so it stays off on amd64 until I do.
Problems I hit
The Ubuntu archive stopped answering during the first multi-arch release. The merge of #241 started run 46425025046, and both release jobs failed building moks-cms-runner, which starts from ubuntu:26.04:
Err:1 http://archive.ubuntu.com/ubuntu resolute InRelease
Could not connect to archive.ubuntu.com:80 (x.x.x.x), connection timed out
E: Package 'ca-certificates' has no installation candidate
E: Unable to locate package libgomp1
ERROR: failed to build: failed to solve: process "/bin/sh -c apt-get update && apt-get install -y --no-install-recommends ca-certificates libgomp1 && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100apt-get update only warned, so the build failed one step later. Since 26.04, arm64 uses archive.ubuntu.com too, so both runners failed, and publish never ran: no tag was half-built. The fix (moks-cms #242 (opens in a new tab), in seo-agent/Dockerfile) tries the official archive, then two mirrors, and treats any failed index download as a failure:
RUN set -eu; \
ok=; \
for mirror in "" http://azure.archive.ubuntu.com/ubuntu/ http://mirrors.edge.kernel.org/ubuntu/; do \
if [ -n "$mirror" ]; then \
echo "apt: the Ubuntu archive did not answer; trying $mirror" >&2; \
rm -rf /var/lib/apt/lists/*; \
sed -i -E "s#^URIs: .*#URIs: $mirror#" /etc/apt/sources.list.d/ubuntu.sources; \
fi; \
if apt-get update -o Acquire::Retries=2 -o Acquire::http::Timeout=20 --error-on=any; then ok=1; break; fi; \
done; \
[ -n "$ok" ] || { echo "apt: neither the Ubuntu archive nor a mirror answered" >&2; exit 1; }; \
apt-get install -y --no-install-recommends -o Acquire::Retries=3 ca-certificates libgomp1; \
rm -rf /var/lib/apt/lists/*Signed-By in ubuntu.sources is untouched, so a mirror can only serve what the Ubuntu archive signed. The #242 release published both architectures.
An index can list a CPU called "unknown". On Contabo, rag-api sat in ImagePullBackOff until moks-rag built for amd64. When I read the old moks-rag-api tag from the registry, it was already an image index, but not a multi-arch one (trimmed to the fields that matter):
{"platform":{"architecture":"arm64","os":"linux"}}
{"platform":{"architecture":"unknown","os":"unknown"},"annotations":{"vnd.docker.reference.type":"attestation-manifest"}}The second entry is a build attestation, which docker/build-push-action adds by default. A check that counts entries would call that multi-arch, so mine filters select(.os != "unknown"). moks-cms and practice-programming avoid the entry by building with --provenance=false.
Verify it works
Ask the registry what a tag holds, with the publish job's own check:
docker buildx imagetools inspect --format '{{json .Manifest}}' ghcr.io/mrjithendar/moks-cms:latest |
jq -r '[.manifests[]?.platform | select(. != null and .os != "unknown") | "\(.os)/\(.architecture)"] | sort | join(" ")'Expected output, as the publish job printed it for this tag:
linux/amd64 linux/arm64Contabo's nodes are all amd64:
kubectl get nodes -L kubernetes.io/archNAME STATUS ARCH
master-1 Ready amd64
worker-1 Ready amd64
worker-2 Ready amd64
worker-3 Ready amd64The site pods run, and the image they run is the multi-arch index:
kubectl -n jithendar get pod -l app=jithendar-com \
-o jsonpath='{range .items[*]}{.status.containerStatuses[*].imageID}{"\n"}{end}'ghcr.io/mrjithendar/moks-cms@sha256:add6833696b0803c753b9b748d1aeb7398ab480eb390858ea6029cbe9382f619
ghcr.io/mrjithendar/moks-cms@sha256:add6833696b0803c753b9b748d1aeb7398ab480eb390858ea6029cbe9382f619sha256:add68336… is the digest of the pr-242 index, the one that holds both linux/arm64 and linux/amd64. The amd64 nodes took the amd64 entry from it.
Key takeaways
- An image built on an arm64 runner is an arm64 image, and a "can this tag be pulled" check won't notice.
- Build each architecture natively and join them with
docker buildx imagetools create; the smoke tests run on the real CPU. - Push per-architecture tags first. Move the tags clusters pull only after both builds have passed.
- Check the index itself: the platforms must be exactly
linux/amd64 linux/arm64, not countingunknown/unknownattestation entries. - Give each architecture its own concurrency group and its own cache scope.
- The wait for a release stayed about the same. Runner time doubled.
Previous: Part 2: Building the Contabo k3s cluster with Terraform and Ansible (opens in a new tab) · Next: Part 4: How GitHub Actions reaches the cluster now (opens in a new tab)



Discussion comments
No comments yet. Start the discussion.