- Published on
Woowangthon 15. Not Broken, Just Slow
- Authors

- Name
- seren-wib
Contents
Part 15 of the series. The story of the afternoon of November 12, when the deploy executor on the leader registered with the GoCD server on the EC2, part of build stage 6 (connecting to the outside). The EC2 joining the private network earlier that day is in part 14, the executor account and the Pod manifest are in part 12, and the big picture is in Woowangthon 0.
0. Introduction
For the deploy pipeline to run, the deploy executor on the leader has to be attached to the GoCD server. The day the server came up on the EC2, registering that executor came first.
In restaurant terms, the GoCD server is the hall that takes orders and hands them out, and the leader's executor is the cook in the kitchen who takes those orders and prepares them. The Secret is the pass the cook shows on entering the hall, and the private network is the staff corridor between hall and kitchen. This post is about the day a new cook registered with the hall, pass in hand, through that corridor. The hall is the GoCD server, the cook is the executor (agent), the pass is a Secret, and the staff corridor is the private network (Tailscale).
The GoCD server came up on the EC2, and I applied the leader's executor Pod and got it registered. Two things caught. One was the key list in the manifest header. The header, written before the server existed, listed two keys, but the deploy job script that arrived in the meantime used a third. The other was the first boot. The Pod was Running almost at once, but registration came 6.5 minutes later. The executor downloads its main program and plugins from the server, and the private network path was going through a DERP server in Tokyo. It was not broken, just slow. The real deploy pipeline has not run once yet.
1. The server is up
Part 12 ended with "the EC2 for the GoCD server doesn't exist yet". Around 3:48 PM on November 12, TaeTaeJin, who owns the EC2, started GoCD server 26.1.0 and the platform server on it. The version and the port (8153) were values I had picked in part 12 when no answer came, and the server came up matching them. Earlier in part 14, the leader → EC2 8153 got connection refused because the path was open but no server was there to answer yet. Now there is one.
The GoCD port is open only on the EC2's tailnet (Tailscale) address. The setup script binds it to 127.0.0.1 first and moves it to the tailnet address once setup is done. I checked from both sides.
| From | What | Result |
|---|---|---|
| Leader host | /go/api/version on the tailnet address | 26.1.0 |
| Leader host | health on the tailnet address | OK |
| Internet (operator desktop) | 8153 and 3000 (server) on the public address | both time out |
Neither GoCD nor the platform server is visible from the internet. The platform server goes out only through a Cloudflare tunnel, the same way as the visitor address in part 10.
2. Not two keys, three
TaeTaeJin, who started the server, sent a request: create the Secret gocd-agent on the leader and apply the executor. The request said there were three keys.
The manifest header listed two: the GoCD server address (GO_SERVER_URL) and the auto-register key (AGENT_AUTO_REGISTER_KEY). Those two are all the executor needs to reach the server. The third, PIPELINE_NOTIFY_TOKEN, is used by the deploy job script (Infra/gocd/job.sh). Each time a stage ends, the script reports the result to the platform server, and this is the token it shows.
The header was written on November 11, from the plan, when there was no server. The job script came in the next day in a server-side PR. In between, the key list drifted from the code. I worked out what would have happened with only the two keys from the header. The manifest reads the whole Secret into env (envFrom). With a key missing, the Pod still starts and still registers. Then, on the first deploy, as soon as a stage ended and the job script tried to report it, it would have failed for lack of a token. Since registration works fine, nobody would notice before then.
The values live in AWS Parameter Store under /wcp/gocd/. The GoCD setup script also leaves the same three lines in a leader-agent.env file on the EC2. Only the server address has no stored source, so I wrote the EC2's tailnet address directly. It is an address, not a name, because the Pod uses cluster DNS, and cluster DNS does not know tailnet device names.
3. Making the Secret without showing it
In part 11 I listed "on the day the token moves, does it move without being printed" as an open item. This was that day. The flow looks like this.
v() { aws ssm get-parameter --name "/wcp/gocd/$1" --with-decryption \
--query Parameter.Value --output text | tr -d '\r\n'; }
{ printf 'GO_SERVER_URL=%s\n' 'http://<EC2 tailnet address>:8153/go'
printf 'AGENT_AUTO_REGISTER_KEY=%s\n' "$(v AGENT_AUTO_REGISTER_KEY)"
printf 'PIPELINE_NOTIFY_TOKEN=%s\n' "$(v PIPELINE_NOTIFY_TOKEN)"
} | ssh k3s-leader 'sudo k3s kubectl -n deploy create secret generic gocd-agent --from-env-file=/dev/stdin'
The values come out of Parameter Store and flow only through pipes, and kubectl on the leader reads them from standard input. They never land on the screen, on a command line or in a file.
The tr -d '\r\n' is there because the operator machine runs Windows. The Windows aws can add a CR at the end of its output. With one CR at the end, both the register key and the token differ from what the server knows by one character. It's an invisible character, so it only shows up as "wrong key", and the cause is hard to find.
I checked for a trailing newline without looking at the values. A Secret stores its values in base64, so I looked only at the lengths.
Checked again on the leader while writing this post. No values, only key names and base64 lengths
| Key | Raw length | Base64 length | With one more character |
|---|---|---|---|
GO_SERVER_URL | 27 | 36 | 40 |
AGENT_AUTO_REGISTER_KEY | 36 | 48 | 52 |
PIPELINE_NOTIFY_TOKEN | 64 | 88 | 88 |
Base64 turns 3 bytes into 4 characters. 27 and 36 are multiples of 3, so a single extra byte adds 4 to the length. The token, though, is 64 bytes. 64 and 65 both become 88 characters (only the number of = at the end differs). Length alone can't catch a newline at the end of the token. While writing this post I decoded the three values on the leader and counted only the CR and LF characters. All three had zero.
4. Running, but not on the list
After the Secret came the apply.
ssh k3s-leader 'sudo k3s kubectl apply -f -' < Infra/executor/agent.yaml
At 4:23 PM the Pod was Running almost at once. The init containers from part 12 put node and helm in place and the executor started. But minutes later it still hadn't appeared in GoCD's agent list. Running without registering looks like a blocked path or a wrong key.
The log said it was neither.
The log inside the executor Pod. Times are UTC; add 9 hours for Korean time. Class names at the start of lines and md5 values are cut
The GoCD agent image doesn't contain the agent itself. The program that starts first (the launcher) downloads agent.jar (about 27 MB) and the plugins from the server, and only then starts the agent. That download took 6.5 minutes: 4 min 28 s for agent.jar alone and 2 minutes for one plugin, tfs-impl.jar. The server itself answered 0.1 seconds after the request (Got server response). The path was open. It was just slow.
The tailnet path was the reason. The leader wasn't reaching the EC2 directly but through Tailscale's relay server (DERP) in Tokyo. It's the same shape as the relay between the school PCs and my devices in part 4. Back then I wrote that I'd measure the platform server's latency again in stage 6, and this is how it got measured. A curl from the leader host to the same server got 5.5 MB in 60 seconds, a little over 90 KB per second. A path you don't notice for a few commands turns into four minutes in front of 27 MB.
Once the download finished and the agent started, registration took under a second: it showed the auto-register key, the server approved it, and it fetched its registration. Right after registration the path switched to a direct connection. Today a tailscale ping from the leader to the EC2 answers in 5 ms with no relay (figure in section 5). I don't know why the relay stuck around just then. Tailscale starts on a relay and moves once it finds a direct path, and this time that seems to have taken a while.
One more thing follows. The executor's working folder is an emptyDir. Part 12 did that on purpose, treating one deploy as one pipeline run. It also means that every time the Pod restarts, it downloads the 27 MB and the plugins from scratch. If the path goes through the relay again, that's another 6.5 minutes. So the executor Pod does not get restarted right before a demo. The manifest header says so too.
5. Checking registration through the leader
Registration shows up in GoCD's Agents API. But the operator desktop can't reach 8153. The tailnet access rules from part 11 open the EC2's 8153 to the leader only. I didn't widen that rule to make my own checks easier.
So I went through the leader. The GoCD admin password is in Parameter Store too. I read it on the desktop, passed it over SSH's standard input, and had curl on the leader read it from standard input instead of a config file (curl -K -). The password doesn't land on the leader's command line (where ps would show it) or on disk. The server address came from the Secret I had just made on the leader.
Called again while writing this post. Only the name, resource, state and version are pulled out of the Agents API JSON. Addresses are masked
There are two agents. wcp-aws-agent runs on the EC2 with the resource aws; it handles the Build stage, which builds images from student repos. k3s-leader-executor is the leader's executor that just joined, with the resource leader. The stages that write to the cluster, Prepare through Switch, carry that resource and come to the leader. The table in part 12 now has two real agents behind it.
6. What went into the docs
On the day of the apply I opened an issue in the team repo (woowangthon/WOOWANGTHON_TEAM_18#164) and fixed the docs in a PR (woowangthon/WOOWANGTHON_TEAM_18#166), which is merged.
| Where | What |
|---|---|
agent.yaml header | Three keys and where each value comes from, the command to load them, the 6.5-minute first boot and the restart warning |
| Cluster design §8 | The executor Pod is applied on the leader and registered as leader |
| Cluster design §12 | The deploy notify token added to the secrets table, source Parameter Store /wcp/gocd/ |
| AI scope table | Executor start, registration and the 8153 path are verified; real pipeline jobs are still unverified |
| Platform hosting doc, task files | The same, plus the first-boot record |
The AI scope table records what was checked directly and what hasn't been checked yet, so I wrote the two apart. "The executor joined" must not read as "deploys work".
7. What has never run
Of the list at the end of part 12, three items are now crossed off: the executor process starting with this setup, registering with the auto-register key, and the path from the Pod to 8153 on the tailnet. This is what's left.
- The real deploy pipeline. I have never seen Prepare → Render → Apply → Verify → Switch run on the leader's executor. Registration means it's ready to take work, not that it can do the work. A test agent with node and helm on the same official image did pick up a Prepare job from a local GoCD server once. But not on the leader, under the executor account's rights and part 12's admission policies.
- Deploy jobs going only to the leader. Whether jobs with the
leaderresource stay off theawsagent only shows once jobs actually arrive. - The trial pipeline.
student-trial, for trial deploys of student apps, isn't defined yet, either in GoCD or in the repo.
TaeTaeJin, the EC2 owner, took the end-to-end deploy test. After the AI owner's (suda5936) work lands, he'll start a deploy from the platform server and see whether the leader's executor puts it in a student space and passes Verify. That's the next post.
8. Reflection
Agent or human, before saying "it doesn't work" we should have looked first at whether the log showed the server answering and whether the private network path was a DERP relay.