Skip to content
All writing Part 06 of 12 · Remote-Controlling Chrome in Containers
Engineering · 4 min read

Port Contract and the Helm default() Trap

Five layers of config must agree on port numbers. Helm's default() silently fills in a wrong value. required() catches the mistake at deploy time.

The Five-Layer Config Chain

A containerized service with a port relay has five layers of config. Each layer must match its neighbors. A mismatch at any layer is silent: the pod starts, no error appears, but connections fail.

Helm values (single source of truth) port: 9222 debugPort: 9223 Deployment template CHROME_FORWARD_PORT = port (socat listens) CHROME_DEBUG_PORT = debugPort (Chrome listens) containerPort = port --remote-debugging-port Service targetPort = port other pods dial this Two Helm values control all five layers

Two Helm values control everything. socat, Chrome, containerPort, and Service.targetPort all trace back to these two numbers.

The default() Trap

Helm default returns a fallback when a value is not set. If the fallback is valid but wrong, the template renders without error. The bug appears only at runtime.

{{ .somePort | default 8080 }} .somePort = 9222 result: 9222 correct .somePort = (not set) result: 8080 WRONG, but no error

default() vs required()

Can any reasonable fallback work? YES default() is safe replica count, log level, timeout NO use required() port numbers, image tags, secrets default(): missing value uses fallback silently required(): missing value fails the template with a clear message A deploy-time error is always better than a silent runtime failure.

“In review, watch for default followed by a different port number, a different image tag, or an empty string for a secret name. That is a landmine.”


References:

Related: see how the entrypoint starts socat that these values feed into, or go back to the series overview.

Tags #kubernetes #chrome-devtools #containers
// connect

Be brave | Be wise | Be grateful

21 BreakinCode

// elsewhere
LinkedInMedium (lang: en)Life RecordYoutube
wh:~$William Hung· © 2026 Taipei · GMT+8 · Available for collaboration