Skip to content

fix(k8s): probe the ghostunnel sidecars on their status port, not their TLS port - #830

Merged
webchang merged 2 commits into
rossoctl:mainfrom
webchang:pr/i724-ghostunnel-probe
Nov 16, 2026
Merged

webchang merged 2 commits into
rossoctl:mainfrom
webchang:pr/i724-ghostunnel-probe

Conversation

@webchang

Copy link
Copy Markdown
Member

Closes #724

What changed and why

  • Every ghostunnel sidecar's readiness probe was a tcpSocket connect to its TLS port. ghostunnel logs each one as error on TLS handshake from …: EOF, so each sidecar wrote a line every 5 s, and real TLS errors were lost in them.

  • ghostunnel TLS sidecars log a handshake error every 5 s from the TCP probe #724 offered two directions. This PR takes the first: probe somewhere other than the TLS port. Silencing the log (ghostunnel's --quiet=handshake-errs) would also hide the real handshake errors, the thing the issue wants to keep visible.

  • Each sidecar now serves ghostunnel's status endpoint on its own port (--status http://0.0.0.0:<port>), and its readiness probe is httpGet /_metrics there:

    Sidecar Overlay TLS port Status port
    tls (supervisor) ocp, ocp-single/routes 8443 8453 (status)
    tls (relay attach) ocp/p4-relay 8444 8454 (status)
    tls-exec (relay exec) ocp-sbx/exec-tls 8445 8455 (status-exec)
  • /_metrics, not /_status: in v1.11.3, /_status dials the target on every request to report backend_ok (and answers 503 when it can't). For the supervisor, whose comment says every connection to 127.0.0.1:8080 is handed off on its own, that would trade a log line for an empty connection every 5 s. /_metrics dials nothing.

  • Exposure: no NetworkPolicy admits the status ports, so the namespaces' default-deny keeps them off the pod network. The kubelet's probes reach them the way they reach the TLS ports today. If a cluster needs the README's node-CIDR fallback for probes, that policy should list the status port too.

  • deploy/k8s/README.md §3 says so in one paragraph.

Validation

  • Reproduced with the pinned ghostunnel v1.11.3 binary. Run as the manifests run it, three plain TCP connects to the TLS port logged three error on TLS handshake … EOF lines.
  • The new probe, run against the real binary. I rendered deploy/k8s/overlays/ocp with kubectl kustomize and ran ghostunnel with the sidecar's rendered args, with only the paths and ports remapped to local ones. Ten GET /_metrics probes answered 200 and logged nothing. A real TLS client still reached the backend through the tunnel, and the backend saw exactly that one connection.
  • Manifest tests (packages/supervisor/test/k8s, with kubectl on the PATH): 105 passed. The three sidecar tests now assert the --status args, the status port and the httpGet probe. Run against these manifests, main's versions of those tests fail.
  • deploy/sbx/tests/overlay.test.sh: a new check that both relay sidecars are probed on /_metrics of their own ports, and that neither has a tcpSocket probe. overlay-combined, and deploy/k8s and deploy/sbx setup.test.sh, also pass.
  • Port names are unique within each pod. prettier, check-doc-links.py, shellcheck (-S warning) and pre-commit pass.
  • Not run on a live OpenShift cluster. The cluster I would use is unreachable right now. A reviewer with one could confirm the pods go Ready and the sidecars' logs stay quiet.

Every commit is signed off (DCO).

Assisted-By: Claude Code

…ir TLS port

Each sidecar's readiness probe was a tcpSocket connect to its TLS port, which ghostunnel logs as a
failed TLS handshake: one line every 5 s per sidecar, hiding real TLS errors. Each sidecar now
serves --status on its own port (8453 beside the supervisor; 8454 and 8455 beside the relay's attach
and exec sidecars), and the probe is GET /_metrics there. /_metrics dials nothing, where /_status
would open a connection to the target on every probe. No NetworkPolicy admits the status ports.

Closes rossoctl#724

Assisted-By: Claude Code
Signed-off-by: Rong Chang <[email protected]>
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Nov 16, 2026

@clawgenti clawgenti left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All checks pass. Ready for human review.

Summary

Reviewed all four overlay patches (ocp, ocp-single/routes, ocp/p4-relay, ocp-sbx/exec-tls), both test suites and the README change against the base manifests. The change is consistent across overlays: each sidecar gains --status http://0.0.0.0:<port> plus a named status containerPort, and its readiness probe becomes httpGet /_metrics on that port instead of a tcpSocket connect to the TLS port. Port names stay unique per pod (status/status-exec), the TS and shell tests assert the exact args, ports and probe shape, and the README's node-CIDR fallback caveat in the PR body matches the existing fallback policy (which never admitted the TLS ports either). No findings.

Author: webchang (MEMBER — maintainer)
Areas reviewed: Helm/K8s, Shell, YAML, Docs, Tests
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (18/18)

Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).

@clawgenti clawgenti left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swapping the ghostunnel sidecars' tcpSocket probes for httpGet /_metrics on a dedicated --status port looks right, and /_metrics over /_status avoids an empty backend connection every 5 s.

Checked: kubectl kustomize of ocp, ocp-sbx and ocp-combined renders the new ports/probes with no container-port or port-name collisions (ocp-combined's relay pod carries both sidecars: 8444/8454 and 8445/8455); no rendered NetworkPolicy has a port-less ingress rule that would admit 8453–8455, so default-deny does keep them off the pod network. Tests pin the args, ports and exact probe. CI is green.

One suggestion (§10 node-CIDR fallback should list the status ports) and one nit inline. Not validated on a live OpenShift cluster, as the PR notes.

Assisted-By: Claude Code

Comment thread deploy/k8s/README.md Outdated
`overlays/ocp/kustomization.yaml`. Each ghostunnel sidecar's readiness probe is `GET /_metrics` on
its own status port (`--status`; 8453 beside the supervisor, 8454 and 8455 beside the relay's attach
and exec sidecars), never a TCP connect to its TLS port, which logged a handshake error every 5 s.
`/_metrics` dials nothing (`/_status` would open a connection to the target on every probe), and

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The PR body says a cluster that needs the node-CIDR fallback for probes should list the status port in that policy too, but §10 ("Kubelet probes and the node-CIDR fallback") still names only 8081 and 8080. Worth adding 8453/8454/8455 there (or a pointer from this paragraph), so an operator on a filtering CNI doesn't end up with sidecars stuck NotReady.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in dadb9df. Section 10's node-CIDR fallback now has a paragraph after the policy: on OpenShift the ghostunnel sidecars are probed on 8453 (supervisor) and 8454/8455 (relay), so a cluster that needs the fallback adds sandbox-relay to the selector and those three ports to the rule, or the sidecars stay NotReady. Section 3's paragraph points to it.

Assisted-By: Claude Code

Comment thread deploy/k8s/README.md Outdated
its own status port (`--status`; 8453 beside the supervisor, 8454 and 8455 beside the relay's attach
and exec sidecars), never a TCP connect to its TLS port, which logged a handshake error every 5 s.
`/_metrics` dials nothing (`/_status` would open a connection to the target on every probe), and
no NetworkPolicy admits the status ports, so only the kubelet's probes reach them. Docker Hub is the project's official channel; it does not

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this line is 140 characters, while the rest of the paragraph wraps at 100. Moving "Docker Hub is the project's official channel…" onto the next line fixes it. The §1 port table ("8443 ghostunnel (OCP)") could also mention 8453.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in dadb9df. The 140-character line came from this PR's paragraph landing in the middle of the image sentence. The image and Docker Hub sentences are back together, and the status-port text is its own paragraph, wrapped at 100. The section 1 table lists 8453 its status (OCP) beside 8443, and the kubelet column says so too.

Assisted-By: Claude Code

… the image paragraph rewrapped

Section 10's fallback names 8453-8455 for a cluster whose CNI filters the kubelet's probes, the
section 1 table lists 8453, and the status-port text is its own paragraph (review suggestion and nit).

Part of rossoctl#724

Assisted-By: Claude Code
Signed-off-by: Rong Chang <[email protected]>
@webchang
webchang merged commit 664e396 into rossoctl:main Nov 16, 2026
17 checks passed
@pdettori pdettori added this to the v0.11.0 milestone Nov 17, 2026
webchang added a commit to webchang/moca that referenced this pull request Nov 17, 2026
Takes upstream main at 1a7f41e (19 merges since 032c8f6): the sandbox
idle lifetime across docs, control plane, clients and deploy (rossoctl#820, rossoctl#837,
rossoctl#842, rossoctl#843), grant redemption (rossoctl#822), the lease-check log line (rossoctl#824),
egress fixes (rossoctl#829, rossoctl#834), the mock wait (rossoctl#828), the deadline timer
(rossoctl#835), the create rollback (rossoctl#832), multi refusals and the rossoctl#363 leftovers
(rossoctl#833, rossoctl#838), the identity near-miss check (rossoctl#827), mocactl login errors
(rossoctl#836), the ghostunnel probes (rossoctl#830), refusal-burst deferral (rossoctl#831), a
sandbox-worker change (rossoctl#841) and the v0.11 doc truth (rossoctl#821).

Conflicts (one):

- deploy/sbx/README.md, the "Optional inputs" table. Upstream (rossoctl#843)
  rewrote the SBX_LIFETIME_DAYS row (the default idle lifetime, at most
  SBX_MAX_LIFETIME_DAYS) and added the SBX_MAX_LIFETIME_DAYS and
  SBX_LOWER_WORKSPACE_IDLE rows, which widened the table; the fork had
  added an SBX_GATE_RECORD_SCHEMA row at its end. Resolved by taking
  upstream's table whole and appending the fork's SBX_GATE_RECORD_SCHEMA
  row after SBX_PROFILE, then re-padding the table with prettier. The
  fork's env-file example line for SBX_GATE_RECORD_SCHEMA merged cleanly.

Merged without markers, checked: setup.sh keeps the fork's
SBX_GATE_RECORD_SCHEMA validation and its sbx-settings write (so it stays
in the settings hash) beside upstream's SH_SANDBOX_MAX_LIFETIME_SECONDS;
both ocp-sbx and ocp-combined patch-control-plane.yaml keep the optional
SH_GATE_RECORD_SCHEMA from sbx-settings beside the new optional
SH_SANDBOX_MAX_LIFETIME_SECONDS; setup.test.sh keeps the fork's cases
beside upstream's. The fork's RUNBOOK, README and template-onboarding
docs say nothing about sandbox lifetime, refusal bursts, login errors or
the create rollback, so none needed a correction; GUIDE.md is unchanged
and GUIDE.pdf is not regenerated.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ghostunnel TLS sidecars log a handshake error every 5 s from the TCP probe

4 participants