- Published on
Woowangthon 8. Refused Is Not the Same as No Answer
- Authors

- Name
- seren-wib
Contents
0. Introduction
Part 8 of the series. The first piece of build stage 5 (a frame for student apps): the day an image cache went up on the leader. The leader GPU work is in part 7, and the big picture is in Woowangthon 0.
Student app images go to GitHub's container registry, GHCR. So that the two workers don't each pull the same image over the school network, I put a cache on the leader.
In restaurant terms, GHCR is a faraway produce market, and the two workers are the kitchens of two branches. If each branch travels to the market on its own, it is slow, so the head office stocks a warehouse once and the branches pick up from there. The warehouse only goes to the market for what it lacks. If the warehouse door is open, a branch gets an immediate "we don't have it" and goes to the market; if the whole warehouse is dark, the branch waits at the door with no answer at all. The market is GHCR, the container registry, the branch kitchens are the worker nodes, the head office warehouse is the leader's pull-through cache, the "we don't have it" is connection refused, and no answer at all is a timeout.
I put a cache on the leader that pulls from GHCR on the workers' behalf, and the second worker got the same image in 1.1 seconds. I also tested that nodes pull straight from GHCR when the cache is off, and an AI reviewer pointed out that a cache being off and a cache not answering are different. Measured again, that cost 30 more seconds.
1. Why a cache
When a student deploys, the build runs on AWS and the image goes to GHCR. A worker pulls that image and runs it. With two workers, the same image gets pulled twice at times, for example when one worker goes down and the app moves to the other.
GHCR was slow from the school network, in the same way that one worker's download stalled in part 6. So the leader pulls from GHCR once and the workers take it from the leader over the switch (about 940 Mbit/s).
The cache is a pull-through cache. When a node asks for an image, the cache hands over what it has; if it has nothing, it fetches from GHCR, passes it on, and keeps it for 7 days. The product is the open-source registry Docker started (CNCF Distribution, registry:3.1.2). One config file is enough, and student images are public, so no GHCR login is needed.
2. Where to bind the cache
The cache listens on the leader's node address, 192.168.77.11:5000. Kubernetes has two ways to open a Pod on a node's port.
| Way | How | Firewall |
|---|---|---|
| hostPort | Traffic to the node port is rewritten to the Pod's address | The rewritten path goes around the firewall's inbound check |
| hostNetwork | The Pod uses the node's network as is (same address too) | The firewall applies exactly as it does to a program running on the node |
I picked hostNetwork, and had the cache listen on the node address only. Nothing on the school address is accepted in the first place, and the firewall lets in only the node network.
There is one price. The Pod Security Standards level planned for student spaces (baseline) forbids hostNetwork, so only the cache's space has that level lifted. In return the container runs as a normal user, with no special privileges (capabilities) and a read-only file system. The level is lifted for one reason only: using the node's network.
3. Making nodes look at the cache first
On all three nodes I put /etc/rancher/k3s/registries.yaml. It is four lines.
mirrors:
ghcr.io:
endpoint:
- 'http://192.168.77.11:5000'
k3s reads it and writes the settings the container runtime (containerd) uses. In the result the cache is a host and GHCR is the server. The runtime tries the host first and the server last.
That server line is what sends pulls to GHCR when the cache is dead. Nothing else to set.
Changing this file means restarting k3s. I did it one node at a time, w2 → w1 → leader, in the order from part 5. Restarting k3s leaves running containers alone, so zero Pods restarted. On the leader, the Kubernetes API was back in 2 seconds.
4. One second for the second worker
The test image was a small public image on GHCR (34.8 MB). I started it on w1 first, and on w2 as soon as that finished.
The cache log confirmed it. The cache writes a line each time it fetches something new from GHCR: nine lines for w1, none at all for w2. w2 got everything from the cache.
With the cache scaled to zero and the image removed from w1, the next pull had the runtime's connection to the cache refused, moved straight on to GHCR, and finished in 44 seconds. From the school address, port 5000 on the leader could not be reached. All three done-criteria passed.
5. The first pull was slower through the cache
Putting the numbers side by side shows something odd.
| Path | Time |
|---|---|
| Through the cache, first (empty) | 1 m 53 s |
| From the cache (second worker) | 1.1 s |
| Straight from GHCR (cache off) | 44 s |
The very first pull through the cache was more than twice as slow as a direct pull. The cache adds a step while it fetches from GHCR and passes things on, and GHCR's speed from the school network also varied (section 6). It is one measurement, so I did not pin down the cause. The fix is clear anyway: pull the images the demo needs once beforehand, and these 1 m 53 s never show up in front of the judges. It is in the docs as a known limit.
6. What the reviewer AI caught: refused vs no answer
I opened the PR, and the review bot (CodeRabbit) didn't come. Instead it left a note: "this repository does not receive automatic reviews because it has fewer than 10 stars." Until last week it reviewed every PR on its own, so the bot's free plan seems to have changed. Repos under 10 stars now need a comment to call it. After a comment calling it in, three findings came. All three were right.
| Finding | Right? |
|---|---|
| The doc says the cache can only go out on 443 and 53, which differs from the firewall table | Yes. Programs on the node also have 80, time sync and Tailscale ports open. 443 and 53 are just what the cache actually uses |
| The 50Gi volume is not a limit | Yes. The storage in use (local-path) is a plain folder on the node and doesn't cap size. The cache has no size limit either, so 7 days is the only cleanup. Watch what piles up with a disk alert |
| "Pulls go straight to GHCR when the leader is down" was never tested | Yes. Below |
The third one stung the most. What I tested in section 4 was the cache scaled to zero. The leader was still on then, so it answered connection refused right away because nothing was on port 5000. A connection refused makes the runtime move to the next address at once. But when the leader loses power, nobody is there to refuse. The runtime opens a connection to an address that never answers, and waits. Refused and no answer are different.
So I faked a dead leader. On w1 I made packets to the leader's port 5000 get dropped silently (DROP) and pulled the same image. Just in case, I first armed a timer that removes the rule by itself after 5 minutes.
It moved to GHCR after waiting 30 seconds, and the whole pull took 3 m 37 s. Even minus those 30 seconds that is 3 m 6 s, while the same image took 44 seconds a few minutes earlier. GHCR's speed from the school network changes from one moment to the next. The docs now say "when the cache can't be reached, every pull first waits 30 seconds; this was not tested by actually powering off the leader."
The docs in this PR were written by an AI agent, and the wrong sentences were caught by an AI reviewer. The contest theme is "Can AI be a colleague?", and this time the colleagues reviewed each other. Calling the reviewer in and pressing the merge button were still done by a person.
7. A question left in the deploy flow
The same night, the deploy flow design by the AI teammate (suda5936) was merged. Its steps are named W0 to W7.
- W4 build goes as far as building the image on AWS and pushing it to GHCR. The cache from this post pulls that image.
- W5 deploy: the leader's runner takes the image tag and the deploy settings, renders the Kubernetes files and applies them. Same as the meeting decision in part 7.
- W6 verify has not settled. The design doc's last commit moved it to the platform server (AWS), but right after the merge the AI teammate said on Discord that keeping it on the leader with W5 would be better. The team lead (TaeTaeJin) asked for a settled answer.
From the cluster side, the leader is easier. The runner account designed in part 7 already includes read access for verification, and no new path from AWS to student apps would be needed. One question is left: is it a single check at the end of a deploy, or does an ongoing watch after the deploy move to the leader too? The latter adds an always-on program to the leader. The plan marks it as "not decided yet."
The first piece of stage 5 is done. Next is the student space template: making the space student apps run in, with resource caps and blocking rules. The cap values have to be agreed with the platform server owner first.
8. Reflection
Refused and no answer are different, so fake a failure the way it will really happen.